PHP SMTP 邮件密送未发送成功

3

抄送/密送(在抬头中)的收件人不会收到邮件。 我找到了一些类似问题的帖子,但没有答案...

下面是代码,问题是:“你们有没有遇到过类似的问题?”

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);

require_once "Mail.php"; 这是哪个库? - Orbling
@Orbling 标准的 PEAR 邮件模块。 - Weston Watson
很高兴你现在已经解决并且运行正常了。另外,我建议你看一下Swift Mailer:http://swiftmailer.org/ - Orbling
1个回答

6
看起来您正在使用PEAR邮件模块。如果您在这里阅读,您会看到有关传递给pear模块的标头仅指定消息显示方式而不是实际接收者的讨论。如果您添加CC标头,该人将显示为被抄送,但要实际接收它,他需要被添加到收件人数组中。对于BCC,您将它们添加到收件人数组中,但不在标头中显示它们。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接