首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么PhpMailer在某些机器上出现故障?

为什么PhpMailer在某些机器上出现故障?
EN

Stack Overflow用户
提问于 2016-03-16 10:24:49
回答 2查看 216关注 0票数 0

我正在用PHPMailer发送电子邮件。我的问题是,在我的PC机上,一切正常工作,但在其他设备上,比如其他笔记本电脑或个人电脑,则会出现以下错误:

代码语言:javascript
复制
SMTP Error: Could not authenticate. Mailer Error: SMTP Error: Could not authenticate.The following From address failed: confidential@confidential.com Mailer Error: The following From address failed: confidential@confidential.com 

SMTP服务器错误:未公告时使用的AUTH命令

有人能给我点光吗?!

我的代码:

代码语言:javascript
复制
$mail             = new PHPMailer(); // defaults to using php "mail()"

$body             = stripslashes($_POST['textarea']);
$body = str_replace(' ',' ',$body);
$body = str_replace('/media/','http://www.confidential.com/media/', $body);
$body = $body;

//$body             = eregi_replace("[\]",'',$body);

    $mail->From       = "confidential@confidential.com";
    $mail->FromName   = "confidential confidential";
    $mail->CharSet  = 'UTF-8';
    $mail->Subject    = $_POST['subject'];
    //$mail->IsSMTP(); // telling the class to use SMTP
    //$mail->Host       = "confidential.com"; // SMTP server    
    //$mail->SMTPAuth   = false;                  // enable SMTP authentication 
    //$mail->Port       = 25;                    // set the SMTP port for the GMAIL server
    //$mail->Username   = "confidential@confidential.com"; // SMTP account username
    //$mail->Password   = "confidential";        // SMTP account password
    $mail->SetFrom('confidential@confidential.com', 'confidential confidential');
    $mail->AddReplyTo("confidential@confidential.com","confidential confidential");     
    //$mail->SMTPDebug = 1;

此外,当我使用SMTP身份验证时,在每个设备上都会出现以下几个错误:

代码语言:javascript
复制
SMTP Error: Could not authenticate. Mailer Error: SMTP Error: Could not authenticate.SMTP Error: The following recipients failed: someemail@test.com Mailer Error: SMTP Error: The following recipients failed: someemail@test.com

SMTP服务器错误:身份验证失败

更新:

完全错误导致:

代码语言:javascript
复制
SMTP -> FROM SERVER:220-sclabo15.ds.systemsunit.com ESMTP Exim 4.86_1 #1 Wed, 16 Mar 2016 13:10:25 +0200 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
SMTP -> FROM SERVER: 250-sclabo15.ds.systemsunit.com Hello confidential.com [176.223.213.66] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP
SMTP -> ERROR: Password not accepted from server: 535 Incorrect authentication data
SMTP -> FROM SERVER:250 Reset OK
SMTP Error: Could not authenticate. Mailer Error: SMTP Error: Could not authenticate.SMTP -> FROM SERVER:250 OK
SMTP -> FROM SERVER:550 Authentication failed
SMTP -> ERROR: RCPT not accepted from server: 550 Authentication failed
SMTP Error: The following recipients failed: confidential@confidential.com Mailer Error: SMTP Error: The following recipients failed: confidential@confidential.com

SMTP server error: Authentication failed 
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-03-16 11:37:02

密码使用非ASCII字符吗?- Martin @Martin, 如果“#”不是ASCII,那么是的。-匿名

您的问题可能是您的密码包含#字符。这个角色有点痛苦,因为它不太适合作为“安全”,但往往没有实际删除或清理的许多清洁功能。它是一个URL地址特殊字符,并多次被认为是导致类似SMTP错误的原因:

https://sourceforge.net/p/davmail/bugs/539/

https://meta.discourse.org/t/bug-smtp-password-field-does-not-escape-comment-sign-hash/23344/6

还检查您的字符串编码用户名和密码字符串。您对$mail->CharSet = 'UTF-8';的引用可能会导致PHPMailer对SMTP的密码进行编码(但我不确定)。

http://www.easy-smtp.com/smtp-troubleshooting-guide

还有其他各种各样的敲门事件,比如您将被阻止在服务器上,因为许多身份验证尝试都失败了。令人沮丧,但需要注意。

http://www.fehcom.de/qmail/smtpauth.html http://www.samlogic.net/articles/smtp-commands-reference-auth.htm

解决方案:调试并将密码更改为不包含#字符,并查看这是否改善了您的情况。但是,请注意您可能会因为太多的错误登录而被阻止,您还需要等待一段时间才能再次获得与te SMTP服务器的明确连接。

票数 0
EN

Stack Overflow用户

发布于 2016-03-16 10:41:14

$mail->SMTPDebug = 2;启用SMTP调试信息(用于测试)

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36032892

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档