我正在使用 php mailer 类向我的客户发送电子邮件。但它失败并出现错误:
Language string failed to load: recipients_failed example@gmail.com
如果我将 $email_to 和 $email_from 的值更改为相同的电子邮件地址,则电子邮件发送成功
这是我发送电子邮件的代码
$email_to = "example@gmail.com";
$email_subject = "bla bla";
$email_from = 'info@domain.com.vn';
$email_message = "hello there";
$mail = new PHPMailer();
$mail->CharSet="UTF-8";
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.domain.com.vn"; // SMTP server
$mail->From = $email_from;
$mail->AddAddress($email_to);
$mail->AddReplyTo($email_from);
$mail->Subject = $email_subject;
$mail->WordWrap = 100;
$mail->Body = $htmlBody;
$mail->isHTML(true);
$mail->AltBody = $email_message;
if(!$mail->Send()){
echo $mail->ErrorInfo;
}
所以它总是会报错,除非我把 $email_to 改成 info@domain.com.vn
谢谢,