PHPMailer身份验证失败 [英] PHPMailer Authentication unsuccessful

查看:328
本文介绍了PHPMailer身份验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在Windows Server 2012上使用PHPMailer来通过SMTP发送报告电子邮件时,出现了身份验证失败错误.

When I try to use PHPMailer on windows server 2012 at work to send report emails using SMTP I got Authentication unsuccessful error.

我在域上使用服务器管理员帐户.

I'm using server administrator account on domain.

我非常确定密码的正确性.

I'm very sure of the correction of the password.

检查以下代码:

require '../PHPMailerAutoload.php';

$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->Host = 'mail.example.com';
$mail->Port = 25;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = "username@example.com";
$mail->Password = "yourpassword";
$mail->setFrom('from@example.com', 'First Last');
$mail->addAddress('whoto@example.com', 'John Doe');
$mail->Subject = 'PHPMailer SMTP options test';
$mail->msgHTML($html_message);

我收到以下答复:

SERVER -> CLIENT: 220 exchangeserverhost.com Microsoft ESMTP MAIL Service ready at Tue, 3 Nov 2015 22:19:26 +0300
CLIENT -> SERVER: EHLO exchangeserverhost.com
SERVER -> CLIENT: 250-exchangeserverhost.com Hello 
CLIENT -> SERVER: STARTTLS
SERVER -> CLIENT: 220 2.0.0 SMTP server ready
CLIENT -> SERVER: EHLO exchangeserverhost.com
SERVER -> CLIENT: 250-exchangeserverhost.com Hello 
CLIENT -> SERVER: AUTH LOGIN
SERVER -> CLIENT: 334 
CLIENT -> SERVER: 
SERVER -> CLIENT: 334 
CLIENT -> SERVER: ==
SERVER -> CLIENT: 535 5.7.3 Authentication unsuccessful
SMTP ERROR: Password command failed: 535 5.7.3 Authentication unsuccessful
SMTP Error: Could not authenticate.
CLIENT -> SERVER: QUIT
SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

推荐答案

问题通过更改$ mail-> SMTPAuth = true解决;为假.

Problem Solved by changing $mail->SMTPAuth = true; to False.

$ mail-> SMTPAuth = False;

$mail->SMTPAuth = False;

这篇关于PHPMailer身份验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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