PHP SMTP BCC,不通过
不会收到 BCC/CC(标头中)中指定的收件人。 我发现了几个有类似问题的帖子,没有答案......
代码如下,问题是:“你们中有人遇到过类似的问题吗?”
require_once "Mail.php";
$host = "mail.mailserver.com";
$username = "[email protected]";
$password = "getyourownpassword";
$headers = array ('From' => "User Name <$username>",
'To' => $to_,
'Cc' => 'Patty <[email protected]>',
'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);
Recipients named in the BCC/CC (in the headers) are not received.
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 = "[email protected]";
$password = "getyourownpassword";
$headers = array ('From' => "User Name <$username>",
'To' => $to_,
'Cc' => 'Patty <[email protected]>',
'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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎正在使用 PEAR 邮件模块。
如果您阅读此处,您会看到有关标头的讨论传递给 pear 模块仅指定消息的外观,而不指定实际获取消息的人。如果您添加抄送标头,该人将显示为已抄送,但要实际接收它,需要将他添加到收件人数组中。对于密件抄送,您可以将它们添加到收件人数组中,但不要在标头中显示它们。
It looks like you're using the PEAR mail module.
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. 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. For BCC, you add them to recpients array, but don't show them in the header.