SMTP ERROR: Password command failed: 535 Incorrect authentication data

在处理一个使用PHPMailer来发送电邮,我在本地使用我的163邮箱来做测试发送电邮,能够成功的发送电邮;当上传到正式平台时,出现了,类似这样的错误信息

SMTP ERROR: Password command failed: 535 Incorrect authentication data ,SMTP connect() failed.

在2015-03-03下午时,接近下班的时候,我在测试出现的,怎么也发送不了邮件,当时我的PHPMailer的SMTPDebug是设置为1的。

到了2015-03-04上午上班时,我也不清楚该如何处理时,我就点击PHPMailer的examples,在sublime text2点击每个*.phps打开预览里面的code,我在"examples/smtp.phps" 中看到SMTPDebug的注释

//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;

对了,昨天我设置为1,只能看到"SMTP ERROR: Password command failed: 535 Incorrect authentication data"的消息

       将SMTPDebug设为2时,我可以看到debug消息中,多了"We do not authorize the use of this system to transport unsolicited"这个消息,大概的意思是:我们没有委托本系统以外的未授权的服务来转发邮件。

      最后笔者尝试使用服务器(空间)上面的一个电邮帐号来发送电邮,具体的smtp的资料,需要你看自己服务器(空间)的电邮(email)资料.笔者使用服务器(空间)上面的一个电邮账户来发送邮件,可以发送成功了。如我的网址:www.exapmle.com,可以使用username@example.com的账户来发送电邮。

原文地址:https://www.cnblogs.com/fsong/p/4312681.html