邮件程序错误:SMTP错误:不接受数据

时间:2016-05-24 05:29:32

标签: php email phpmailer

我想通过PHP发送邮件,所以我使用的是PHPMailer。不知道为什么我会收到这个错误。

  

邮件程序错误:SMTP错误:数据未被接受.STP服务器错误:DATA END命令失败详细信息:不允许中继 - 发件人域不是本地SMTP代码:530

这是我的代码。

require '../library/PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->IsSMTP();
//From email address and name
$mail->From = "my@email.address";
$mail->FromName = "Full Name";

//To address and name
$mail->addAddress("my@email.address", "Recipient Name");
//$mail->addAddress("recepient1@example.com"); //Recipient name is     optional

//Address to which recipient will reply
$mail->addReplyTo("p.archish@live.com", "Reply");



//Send HTML or Plain Text email
$mail->isHTML(true);

$mail->Subject = "Subject Text";
$mail->Body = "<i>Mail body in HTML</i>";
//$mail->AltBody = "This is the plain text version of the email content";

if(!$mail->send()) 
{
    echo "Mailer Error: " . $mail->ErrorInfo;
} 
else 
 {
   echo "Message has been sent successfully";
}

任何帮助或建议?我没有在本地执行此代码,它在服务器上。

1 个答案:

答案 0 :(得分:1)

服务器允许在没有身份验证的情况下发送是不常见的。我建议设置Host,SMTPAuth,Username和Password属性,作为PHPMailer show提供的示例。