I'm trying to send mail with PHPMailer but it fails... I have activated the debug mode to show my errors but I don't understand the message returned by the SMTP server.
My code :
<?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 = '[email protected]'; // 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('[email protected]', '... ...'); // 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';
}
?>
This returns :
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.
It seems that the auth is not correct... Can you help me?
Thank you!