I am trying to make a registration form with password confirmation with PHPMailer. My code for my phpmailer data
function enviarEmail($email, $nombre, $asunto, $cuerpo){
require_once 'PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->IsHTML(true);
$mail->Username = "[email protected]";
$mail->Password = "MiContraseña";
$mail->setFrom("[email protected]");
$mail->Subject = $asunto;
$mail->Body = $cuerpo;
$mail->addAddress($email);
if($mail->send())
return true;
else
return false;
}
In the error of doing I get the following:
2018-09-26 14:23:50 SMTP ERROR: Failed to connect to server: (0) 2018-09-26 14:23:50 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Then, I realized that when I open my gmail account I get the following message:
When I clicked to see activity, I get another message that is as follows:
And I do not know if the problem has to do with the permissions that my account has or if there is a better way to solve ..