2014-06-23 05:08

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   = '';
$asunto = $_POST['subject'];
$mensaje = $_POST['mensaje'];
$headers = 'From:';
$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!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • dongwu4834 dongwu4834 7年前

    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.

    点赞 评论 复制链接分享
  • douping4436 douping4436 7年前

    I think it is because you forgot to use " " at the end of from header.

    Hope it help

    点赞 评论 复制链接分享