phpmailer zoho SMTP auth失败

时间:2014-11-10 16:55:18

标签: php smtp phpmailer zoho

我正在尝试使用PHPMailer发送邮件,但它失败了......我已经激活了调试模式以显示我的错误,但我不理解SMTP服务器返回的消息。

我的代码:

<?php
require 'PHPMailer-master/PHPMailerAutoload.php';

$mail = new PHPMailer;

$mail->SMTPDebug = 3;                               // Enable verbose debug output

$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp.zoho.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = '...@....info';                 // SMTP username
$mail->Password = '...';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;                                    // TCP port to connect to

$mail->addAddress('...@gmail.com', '... ...');     // Add a recipient

$mail->WordWrap = 50;                                 // Set word wrap to 50 characters
$mail->isHTML(true);                                  // Set email format to HTML

$mail->Subject = 'Here is the subject';
$mail->Body    = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>

返回:

2014-11-10 16:19:19 Connection: opening to smtp.zoho.com:587, t=300, opt=array ( ) 
2014-11-10 16:19:19 Connection: opened 
2014-11-10 16:19:19 SERVER -> CLIENT: 220 mx.zohomail.com SMTP Server ready November 10, 2014 8:19:22 AM PST 
2014-11-10 16:19:19 CLIENT -> SERVER: EHLO izanagi1995.info 
2014-11-10 16:19:20 SERVER -> CLIENT: 250-mx.zohomail.com Hello izanagi1995.info (ns396731.ip-37-59-1.eu (37.59.1.75)) 250-STARTTLS 250 SIZE 25000000 
2014-11-10 16:19:20 CLIENT -> SERVER: STARTTLS 2014-11-10 16:19:20 SERVER -> CLIENT: 220 Ready to start TLS. 
2014-11-10 16:19:21 CLIENT -> SERVER: EHLO izanagi1995.info 
2014-11-10 16:21:34 SERVER -> CLIENT: 250-mx.zohomail.com Hello izanagi1995.info (ns396731.ip-37-59-1.eu (37.59.1.75)) 250-AUTH LOGIN PLAIN 250 SIZE 25000000 
2014-11-10 16:21:34 CLIENT -> SERVER: AUTH LOGIN 
2014-11-10 16:21:34 SERVER -> CLIENT: 
2014-11-10 16:21:34 SMTP ERROR: AUTH command failed: 
2014-11-10 16:21:34 SMTP NOTICE: EOF caught while checking if connected 
2014-11-10 16:21:34 Connection: closed 
2014-11-10 16:21:34 SMTP connect() failed. Message could not be sent.Mailer Error: SMTP connect() failed.

似乎认证不正确......你能帮助我吗?

谢谢!

0 个答案:

没有答案