phpmailer - 以下SMTP错误:数据未被接受 [英] phpmailer - The following SMTP Error: Data not accepted

查看:648
本文介绍了phpmailer - 以下SMTP错误:数据未被接受的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出这个问题6个小时。但没有任何意义。这是场景;有一个格式很好的 HTML 模板。

  $ mail_body ='
< b>消息号:< / b> 769< br />
< b>消息日期:< / b> 2013-04-08 09:03:21< br />
< b>名称:< / b> John Doe< br />
< b>电话:< / b> 123456789< br />
< b>电子邮件:< / b> abcdf@somedomain.com< br />
< b>消息:< / b>这是消息信息< br />
';

以下是收件人邮件数组:

  $ recipients = array(abc@something.com,xyz@somtehing.com); 

一切看起来都很好,电子邮件准备好发送。这是phpmailer config;

  $ mail = new PHPMailer(); 
$ mail-> IsSMTP();
$ mail-> From =noreply@something.com;
$ mail-> FromName =TEST;
$ mail-> WordWrap = 50;

foreach($ recipients as $ mail_add){
$ mail-> AddAddress($ mail_add);
}
$ mail-> IsHTML(true);
$ mail-> Subject =TEST Subject;
$ mail-> Body = $ mail_body;
if(!$ mail-> Send()){
echo $ mail-> ErrorInfo;
} else {
echoMail sent ...;
}

我测试一切都一样。但有时发送电子邮件。有时没有发送。给我以下错误:以下SMTP错误:数据未被接受。



我希望我解释

解决方案

您的服务器dosen不允许不同的发件人和用户名
您应该配置: $ mail-> ;从 $ mail->用户名


I'm trying to figure out this issue for 6 hours. But there is nothing to make sense. Here is the scenario; There is a well formatted HTML template.

$mail_body = '
    <b>Message Num :</b> 769<br />
    <b>Message Date :</b> 2013-04-08 09:03:21<br />
    <b>Name :</b> John Doe<br />
    <b>Phone :</b> 123456789<br />
    <b>E-mail :</b> abcdf@somedomain.com<br />
    <b>Message :</b> Here is the message info<br />
';

Here is the array of recipients' mails;

$recipients = array("abc@something.com","xyz@somtehing.com");

Everything looks fine and email ready to send.Here is the phpmailer config;

$mail = new PHPMailer(); 
$mail->IsSMTP();
$mail->From = "noreply@something.com"; 
$mail->FromName = "TEST";
$mail->WordWrap = 50;

foreach($recipients as $mail_add) {
    $mail->AddAddress($mail_add);
}
$mail->IsHTML(true);
$mail->Subject = "TEST Subject";
$mail->Body = $mail_body;
if(!$mail->Send()) {
    echo $mail->ErrorInfo;
} else { 
        echo "Mail sent...";
}

Everything is same when I test it. But sometimes email was sent. Sometimes it was not sent. Give me the following error : The following SMTP Error: Data not accepted.

I hope I explained

解决方案

your server dosen't allow different sender and username you should config: $mail->From like $mail->Username

这篇关于phpmailer - 以下SMTP错误:数据未被接受的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆