0

My code is working fine, and I am receiving mail, but the Cc mail is not receiving, and there is no error showing up:

This is my code:

$name=$_POST['name'];
$mobile=$_POST['mobile'];
$email=$_POST['email'];
$cat=$_POST['cat'];
$date=date("y-m-d");

$emailList="abc@yahoo.com,abc123@gmail.com";

$to = "to@gmail.com";
$subject .= "Query";
$headers .= "cc: ".$emailList."\r\n";
$headers .= "From: ".$email."\r\n" .
"X-Mailer: php";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = "Name: ".$name."\r\n";
$message .= "Mobile: ".$mobile."\r\n";
$message .= "Email ID: ".$email."\r\n";
$message .= "Query For: ".$cat."\r\n";
$retval = mail($to,$subject,$message,$header);
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Rids
  • 55
  • 5

2 Answers2

0

Typo error. Change to:

$retval = mail($to,$subject,$message,$headers);
-2

I have tested the code in my localhost server and It is working fine.

$emailList="cc1p@gmail.com, cc2@gmail.com";

$to = "to@gmail.com";
$subject = "Query";
$headers = "cc: ".$emailList."\r\n";
$headers .= "From: "."my mail"."\r\n" ."X-Mailer: php";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = "message";
$retval = mail($to,$subject,$message, $headers);
Md Riadul Islam
  • 1,273
  • 11
  • 25