我正在使用PHP邮件并尝试发送BCC,但出于某种原因,因为我已经在其上添加了// ADDED NEW的行,它现在只是发送任何电子邮件。
以下是完整代码:
$to = "me@gmail.com";
$bcc = $row['recipients']; //ADDED NEW
$subject = $row['subject'];
$message = $row['text_body'];
$headers = "From: " . strip_tags('me@gmail.com') . "\r\n";
$headers .= "Reply-To: ". strip_tags('me@gmail.com') . "\r\n";
$headers .= "Bcc: $emailList\r\n"; //ADDED NEW
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to, $bcc, $subject, $message, $headers); // $bcc ADDED NEW
为什么不发送?
答案 0 :(得分:1)
$bcc
函数没有mail()
个参数。它应该是:
mail($to, $subject, $message, $headers);
将从Bcc
中的$headers
标题中检索盲人收件人。
答案 1 :(得分:1)
你的问题,
$bcc
但在$headers
中未使用mail
函数。试试这个
$to = "me@gmail.com";
$bccList = $row['recipients']; //ADDED NEW
$subject = $row['subject'];
$message = $row['text_body'];
$headers = "From: " . strip_tags('me@gmail.com') . "\r\n";
$headers .= "Reply-To: ". strip_tags('me@gmail.com') . "\r\n";
$headers .= "Bcc: $bccList\r\n"; //ADDED NEW
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to, $subject, $message, $headers); // $bcc ADDED NEW