php phpmailer 交换服务器认证
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13587983/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
phpmailer exchange server authentication
提问by Civan Kazanova
My mail send code:
我的邮件发送代码:
$mail = new PHPMailer(true);
$mail->IsSMTP();
try {
$mail->Host = 192.168.205.19;
$mail->Port = 25;
$mail->SMTPDebug = 2;
$mail->SMTPSecure = "tls";
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "mypassword";
$mail->From = "[email protected]";
$mail->FromName = "My Mail Address";
$mail->SetFrom("[email protected]", "My Mail Address");
$mail->AddAddress('[email protected]');
$mail->Subject = "Test for subject";
$mail->MsgHTML("Test my mail body");
if ($mail->Send()) {
$result = 1;
} else {
$result = "Error: " . $mail->ErrorInfo;
}
} catch (phpmailerException $e) {
$result = $e->errorMessage();
} catch (Exception $e) {
$result = $e->getMessage();
}
return $result;
Result?
结果?
SMTP -> FROM SERVER:220 evo.callpex.int Microsoft ESMTP MAIL Service ready at Tue, 27 Nov 2012 17:45:24 +0200
SMTP -> ERROR: Password not accepted from server: 535 5.7.3 Authentication unsuccessful
I'm using PHPMailer class for sent mail. And SMTP. I'm connecting to Exchange Mail server. But I have this error.
我正在使用 PHPMailer 类发送邮件。和 SMTP。我正在连接到 Exchange 邮件服务器。但我有这个错误。
Why?
为什么?
Thanks!
谢谢!
回答by Siva Kumar J
May be you are using Administrator credentials. Don't know why but even I was not able to send mail using PHPMailer with admin credentials(There may be some security measures applicable for Administrator details). Try giving any other user credentials, it will work. It works for me with other user credentials.
可能是您正在使用管理员凭据。不知道为什么,但即使我也无法使用带有管理员凭据的 PHPMailer 发送邮件(可能有一些适用于管理员详细信息的安全措施)。尝试提供任何其他用户凭据,它会起作用。它适用于我的其他用户凭据。
And, In your code
而且,在你的代码中
$mail->From = "[email protected]";
$mail->FromName = "My Mail Address";
$mail->SetFrom("[email protected]", "My Mail Address");
$mail->SetFrom("mailid","name") itself will set From & FromName values. You no need to set that again.
$mail->SetFrom("mailid","name") 本身将设置 From 和 FromName 值。您无需再次设置。

