douan4106 2014-04-17 10:21
浏览 28
已采纳

PHP邮件发送BCC无法正常工作

I am using PHP mail and trying to send BCC, but for some reason since I've added the lines with //ADDED NEW on it , it's just now sending any emails at all.

Here is the full code:

 $to = "me@gmail.com";
 $bcc = $row['recipients']; //ADDED NEW
 $subject = $row['subject'];
 $message = $row['text_body'];

 $headers = "From: " . strip_tags('me@gmail.com') . "
";
 $headers .= "Reply-To: ". strip_tags('me@gmail.com') . "
";
 $headers .= "Bcc: $emailList
"; //ADDED NEW
 $headers .= "MIME-Version: 1.0
";
 $headers .= "Content-Type: text/html; charset=ISO-8859-1
"; 

 mail($to, $bcc, $subject, $message, $headers); // $bcc ADDED NEW

Why is this not sending?

  • 写回答

2条回答 默认 最新

  • dongsisui7562 2014-04-17 10:35
    关注

    Your problem,

    1. Set $bcc but in $headers does not using it
    2. Putting invalid argument into mail function.

    Try this

    $to = "me@gmail.com";
    $bccList = $row['recipients']; //ADDED NEW
    $subject = $row['subject'];
    $message = $row['text_body'];
    
    $headers = "From: " . strip_tags('me@gmail.com') . "
    ";
    $headers .= "Reply-To: ". strip_tags('me@gmail.com') . "
    ";
    $headers .= "Bcc: $bccList
    "; //ADDED NEW
    $headers .= "MIME-Version: 1.0
    ";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1
    "; 
    
    mail($to, $subject, $message, $headers); // $bcc ADDED NEW
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 三菱FX系列PLC串口指令
  • ¥15 cocos的js代码调用wx.createUseInfoButton问题!
  • ¥15 关于自相关函数法和周期图法实现对随机信号的功率谱估计的matlab程序运行的问题,请各位专家解答!
  • ¥15 Python程序,深度学习,有偿私
  • ¥15 扫描枪扫条形码出现问题
  • ¥35 poi合并多个word成一个新word,原word中横版没了.
  • ¥15 【火车头采集器】搜狐娱乐这种列表页网址,怎么采集?
  • ¥15 求MCSCANX 帮助
  • ¥15 机器学习训练相关模型
  • ¥15 Todesk 远程写代码 anaconda jupyter python3