简体   繁体   English

PHP SMTP BCC,没有通过

[英]PHP SMTP BCC, not going through

Recipients named in the BCC/CC (in the headers) are not received. 未收到BCC / CC(标题中)中指定的收件人。 I've found a couple of posts with similar questions, no answers... 我发现了几个有类似问题的帖子,没有答案......

The code is below, the question is: "Have any of you had similar problems?" 代码如下,问题是:“你们有没有类似的问题?”

require_once "Mail.php";

$host = "mail.mailserver.com";
$username = "notification@yourhost.com";
$password = "getyourownpassword";

$headers = array ('From' => "User Name <$username>",
                  'To' => $to_,
                  'Cc' => 'Patty <patty@gmail.com>',
                  'Subject' => $subj_,
                  'Content-type' => 'text/html');

$smtp = Mail::factory('smtp',
                      array ('host' => $host,
                             'auth' => true,
                             'username' => $username,
                             'password' => $password));

$mail = $smtp->send($to_, $headers, $mail_msg);

It looks like you're using the PEAR mail module. 看起来你正在使用PEAR邮件模块。 if you read here You'll see a discussion about the headers passed to the pear module only specifies how the message looks, not to who actually gets it. 如果你在这里阅读你会看到关于传递给pear模块的标题的讨论只指定了消息的外观,而不是实际获取它的人。 If you add a CC header, that person will show up as being CC'd but to actually receive it he needs to be added to the recipients array. 如果您添加CC标头,该人将显示为CC'd但实际接收它,则需要将其添加到收件人阵列。 For BCC, you add them to recpients array, but don't show them in the header. 对于BCC,您将它们添加到recpients数组,但不在标题中显示它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM