I receive this error: SMTP Error: Could not authenticate.
This is the code, i think that everything is ok, the password is ok, the emails are ok, ist in localhost,...
<?php
require './class.phpmailer.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = "email@gmail.com";
$mail->Password = "*********";
$mail->SetFrom('email@gmail.com', 'user');
$mail->AddAddress('email2@gmail.com', 'user');
$mail->Subject = 'this is a text email';
$mail->MsgHTML('content');
$mail->AltBody = 'This is a plain-text message body';
if(!$mail->Send()) {
echo "Error: " . $mail->ErrorInfo;
} else {
echo "Send!";
}
?>