I tried several codes to send email. I get "SMTP Error: Could not authenticate". Finally found this code, looked good for me. They say it works. But i still get the same error. I use xampp. Nothing wrong with the username and the password. Any suggestions??
Here's the code,
require_once ("PHPMailer\class.phpmailer.php");
$Correo = new PHPMailer();
$Correo->IsSMTP();
$Correo->SMTPAuth = true;
$Correo->SMTPSecure = "tls";
$Correo->Host = "smtp.gmail.com";
$Correo->Port = 587;
$Correo->Username = "****@gmail.com";
$Correo->Password = "****";
$Correo->SetFrom('****@gmail.com','De Yo');
$Correo->FromName = "From";
$Correo->AddAddress("****@hotmail.com");
$Correo->Subject = "Prueba con PHPMailer";
$Correo->Body = "<H3>Bienvenido! Esto Funciona!</H3>";
$Correo->IsHTML (true);
if (!$Correo->Send())
{
echo "Error: $Correo->ErrorInfo";
}
else
{
echo "Message Sent!";
}