我的代码工作正常,我正在接收邮件,但是Cc邮件没有收到,并且没有出现错误:
这是我的代码:
$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);
答案 0 :(得分:0)
错字错误。 改为:
$retval = mail($to,$subject,$message,$headers);
答案 1 :(得分:-2)
我已经在我的localhost服务器上测试了代码并且工作正常。
$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);