0

In my following code it working fine for one email id but when I changed $to with two email id like $to = "test1@gmail.com,test2@gmail.com" then it not sent email to receptions emails.

$to = "test1@gmail.com";
$subject = "Student details";
$msg = "Body Message here";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";    
if(mail($to,$subject,$msg,$headers))
{
    echo "email sent successfully";
}

Might be this question look like silly but it difficult for me to debug why it is not working for multiple email.

Sadikhasan
  • 18,365
  • 21
  • 80
  • 122
  • I have no problem sending such an e-mail with my local PHP instance. It also complies to the `$to` format specified in [the docs](http://php.net/mail). – Boldewyn Jun 17 '15 at 11:19
  • @Boldewyn I checked with single email its work fine but multiple email its not working can you suggest what actual issue? – Sadikhasan Jun 17 '15 at 11:22
  • http://stackoverflow.com/questions/25617992/how-to-style-a-php-email-form-body/25618234#25618234 hope this helps – black Jun 17 '15 at 11:23
  • If it's not necessary to write pure php for sending emails than check phpmailer its library for sending emails and it allows you to send multiple emails. – Rinor Dreshaj Jun 17 '15 at 11:25
  • 1
    Why question downvoted please comment for downvote. – Sadikhasan Jun 17 '15 at 11:29
  • Yes, I don't see a downvote reason, either. (By the way, have you access to the server's error log?) – Boldewyn Jun 17 '15 at 12:00

0 Answers0