PHP SMTP BCC,不通过

发布于 2024-10-05 10:50:46 字数 1047 浏览 3 评论 0原文

不会收到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

溺孤伤于心 2024-10-12 10:50:46

您似乎正在使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文