我可以向主机域上的电子邮件地址发送电子邮件,因此向 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