注释过的to2
变量工作正常。但是Gmail id
无法正常工作。
当我执行此代码时,第一个条件是打印Yes
,第二个条件是打印No
:
$to = "info@ebitmoney.com";
//$to2= "enquiry@ebitmoney.com"; //this variable is working
$to2= "abhisekh.milkyway@gmail.com"; // this is not working
$subject = "HTML email";
$message = "hello";
$header = "From: abhishek@milkywayservices.com\r\n";
$header.= "MIME-Version: 1.0\r\n";
$header.= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$header.= "X-Priority: 1\r\n";
$send1=mail($to,$subject,$message,$header);
$send=mail($to2,$subject,$message,$header);
if($send1){
echo 'Yes';
}
else{
echo 'No';
}
if($send){
echo 'Yes';
}
else{
echo 'No';
}
答案 0 :(得分:0)
尝试一下
//$to = "info@ebitmoney.com";
//$to2= "enquiry@ebitmoney.com"; //this variable is working
//$to2= "abhisekh.milkyway@gmail.com"; // this is not working
$email_to = "info@ebitmoney.com, abhisekh.milkyway@gmail.com";
$subject = "HTML email";
$message = "hello";
$header = "From: abhishek@milkywayservices.com\r\n";
$header.= "MIME-Version: 1.0\r\n";
$header.= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$header.= "X-Priority: 1\r\n";
$send1=mail($email_to,$subject,$message,$header);
$send=mail($to2,$subject,$message,$header);
if($send1){
echo 'Yes';
}
else{
echo 'No';
}
if($send){
echo 'Yes';
}
else{
echo 'No';
}
如果此操作无效,则可能是您的SMTP设置出现问题。
请在此处发布您的SMTP设置。 (不要发布密码。)