我正在使用 PHPMailer 在共享服务器上通过 SMTP 发送电子邮件(我的托管服务是 Softsys)。电子邮件被很好地发送到同一服务器上的电子邮件地址(即@域是我的网络域)。但是,当我尝试将收件人更改为 @gmail(或任何外部地址)时,我收到以下错误日志:
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "550 <jDoe@gmail.com> No such user here"
SMTP -> get_lines(): $data is "550 <jDoe@gmail.com> No such user here"
SMTP -> FROM SERVER:550 <jDoe@gmail.com> No such user here
SMTP -> ERROR: RCPT not accepted from server: 550 <jDoe@gmail.com> No such user here
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "250 OK"
SMTP -> get_lines(): $data is "250 OK"
SMTP -> FROM SERVER: 250 OK
Message could not be sent.
Mailer Error: SMTP Error: The following recipients failed: jDoe@gmail.com
这是我的服务器还是我的代码的问题?我应该联系我的服务器管理员吗?预先感谢您的任何帮助!
这是我的代码
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "mail.mywebsite.com";
$mail->SMTPAuth = true;
$mail->Username = "myemail";
$mail->Password = "********";
$mail->From = "myemail@mywebsite.com";
$mail->FromName = "John Doe";
$mail->AddAddress("jDoe@gmail.com");
$mail->IsHTML(true);
$mail->Subject = "Here is the subject";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";