duanlu1279 2013-03-14 07:30
浏览 42
已采纳

如何使用PHP发送超过2封电子邮件?

I want to send two emails at a same time for two different users. I am using php mail function. below is the code.

 Send_Mail('abc@example.com,abc2@example.com','Welcome',$message);

when I send it to single user, it works fine.But when I add two mail address it didnt work.. Is there any other method is there to solve this??? Help me frnds..

Thanks in Advance..

  • 写回答

5条回答 默认 最新

  • dshw124502 2013-03-14 07:38
    关注

    You may need to specify the recipients in the header if you send the email to more than one address.

    $to = 'abc@example.com' . ', ' . 'abc2@example.com';
    $subject = 'Welcome';
    
    // To send HTML mail, the Content-type header must be set
    $headers  = 'MIME-Version: 1.0' . "
    ";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "
    ";
    
    // Additional headers
    $headers .= 'To: ' . $to . "
    ";
    //$headers .= 'From: Someone <someone@example.com>' . "
    ";
    //$headers .= 'Cc: otherperson@example.com' . "
    ";
    //$headers .= 'Bcc: theotherperson@example.com' . "
    ";
    
    Send_Mail($to, $subject, $message, $headers);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?