PHPMailer を使用して、共有サーバー (私のホスティング サービスは Softsys) で SMTP 経由で電子メールを送信しています。電子メールは同じサーバー上の電子メール アドレスに正常に送信されています (つまり、@ ドメインは私の Web ドメインです)。ただし、受信者を @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";