开发者

PHP SMTP BCC, not going through

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 = "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 = $开发者_StackOverflow社区smtp->send($to_, $headers, $mail_msg);


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜