douli0531 2014-06-23 05:08
浏览 26
已采纳

PHP:为什么mail()在有多个收件人时不会发送密件抄送? [关闭]

I´m testing mail() capabilities, and I have this form field named "mailList" which is a textarea witha couple of mails separated by commas.

So here´s my input form: <textarea name="listadoMails"></textarea>

And I´m trying this:

$listadoMails = $_POST["listadoMails"];

$para   = 'myOwnMail@gmail.com';
$asunto = $_POST['subject'];
$mensaje = $_POST['mensaje'];
$headers = 'From: myOwnMail@mysite.com';
$headers .= 'Bcc: '.$listadoMails. "
";
$headers  = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";


if($_POST['listadoMails']) {
    //mando mail a los usuarios
    $envioUsuarios = mail($para, $asunto, $mensaje, $headers);
    }

if($envioUsuarios) { // I then echo a message that the email was successfully sent.
    echo 'Se envió mensaje a '. $listadoMails;  
}

Te message appears as successfully sent. The mail is just sent to my own email, and the From line in that only email sent is "Nobody "

So I have two issues really:

BBC emails are not sent, and the From address won´t work either!

  • 写回答

2条回答 默认 最新

  • dongwu4834 2014-06-23 15:22
    关注

    I´ve found that it was a silly mistake:

    $headers  = 'MIME-Version: 1.0' . "
    ";
    

    should have been

    $headers  .= 'MIME-Version: 1.0' . "
    ";
    

    I didn´t add that line to the first one and everything broke.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿