我可以将电子邮件发送到主机域上的电子邮件地址,因此发送电子邮件到me@domain.com工作,邮件主机是domain.com,但如果我发送到me@gmail.com,它不会来了,我没有从phpMailer得到任何错误,启用调试,它显示一切都已完成。这是我的phpMailer设置:
require_once("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->SMTPDebug = 2;
$mail->Host = "mail.mydomain.co.uk"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "sendmail@mydomain.co.uk"; // SMTP username
$mail->Password = "password"; // SMTP password
$mail->From = "info@mydomain.com"; //do NOT fake header.
$mail->FromName = "Me";
$mail->AddAddress("you@gmail.com"); // Email on which you want to send mail
$mail->Subject = "Just a Test";
$mail->Body = "Hello. I am testing <b>PHP Mailer.</b>";
if(!$mail->Send()){
echo $mail->ErrorInfo;
}else{
echo "<p>Thank you, we will be in touch shortly</p>";
}
发生了什么事?就邮件而言,它已发送,因为我回来了
SMTP -> FROM SERVER:250 Requested mail action okay, completed
SMTP -> FROM SERVER:250 Requested mail action okay, completed
SMTP -> FROM SERVER:354 Start mail input; end with .
SMTP -> FROM SERVER:250 Requested mail action okay, completed