I try to work with smtp of gmail, but I get error:
2016-08-29 11:29:03 CLIENT -> SERVER: EHLO www.*****.com 2016-08-29 11:29:03 CLIENT -> SERVER: STARTTLS 2016-08-29 11:29:03 CLIENT -> SERVER: EHLO www.*****.com 2016-08-29 11:29:03 CLIENT -> SERVER: AUTH LOGIN 2016-08-29 11:29:03 CLIENT -> SERVER: NXN0YXJob3ZhbG90Lm9mZmVyc0BnbWFpbC5jb20= 2016-08-29 11:29:03 CLIENT -> SERVER: Z2VsYTIwMTY= 2016-08-29 11:29:05 SMTP ERROR: Password command failed: 535 Incorrect authentication data 2016-08-29 11:29:05 SMTP Error: Could not authenticate. 2016-08-29 11:29:05 CLIENT -> SERVER: QUIT 2016-08-29 11:29:05 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
i'm using this code:
<?
ini_set('display_errors', '1');
require_once('class.phpmailer.php');
require_once('class.smtp.php');
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = 1;
// 0 = no output, 1 = errors and messages, 2 = messages only.
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets Gmail as the SMTP server
$mail->Port = 587; // set the SMTP port for the GMAIL
$mail->Username = "544@gmail.com"; // Gmail username
$mail->Password = "232323"; // Gmail password
$mail->CharSet = 'windows-1250';
$mail->SetFrom ('544@gmail.com', 'Example.com Information');
$mail->AddBCC ( '544@gmail.com', 'Example.com Sales Dep.');
$mail->Subject = $subject;
$mail->ContentType = 'text/plain';
$mail->IsHTML(false);
$body_of_your_email="ssffs";
$mail->Body = $body_of_your_email;
// you may also use $mail->Body = file_get_contents('your_mail_template.html');
$mail->AddAddress ('544@gmail.com', 'Recipients Name');
// you may also use this format $mail->AddAddress ($recipient);
if(!$mail->Send())
{
$error_message = "Mailer Error: " . $mail->ErrorInfo;
} else
{
$error_message = "Successfully sent!";
}
?>