Mailer Error: SMTP Error: data not accepted

匿名 (未验证) 提交于 2019-12-03 09:05:37

问题:

I want to send mail through PHP, so i am using PHPMailer. Don't know why i am getting this error.

Mailer Error: SMTP Error: data not accepted.SMTP server error: DATA END command failed Detail: Relaying not allowed - sender domain not local SMTP code: 530

This is my code.

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"; } 

Any help or suggestion? and i am not executing this code on local, it's on server.

回答1:

It's unusual for a server to allow sending without authentication. I suggest setting the Host, SMTPAuth, Username and Password properties, as the examples provided with PHPMailer show.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!