I see myself in the painful obligation of coming to you for help. Even though I had already posted something about PHPMailer it turns out that now it stopped working like out of the blue. I tell you: I have the following code (I omitted the mysql query because it seems unnecessary)
<?php
date_default_timezone_set('Etc/UTC');
require 'PHPMailer/PHPMailerAutoload.php';
require ('conexion.php');
$nombre = "";
$link = "";
$serial = $_POST['serial'];
$marca = $_POST['marca'];
$localidad = $_POST['localidad'];
$barrio = $_POST['barrio'];
$direccion = $_POST['direccion'];
$mensaje = $_POST['mensaje'];
///Consulta MySQL
$correo_recibe = $valor['email'];
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->Host = 'ssl://smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->CharSet = 'UTF-8';
$mail->Username = "bic***@gmail.com";
$mail->Password = "*******";
$mail->setFrom('Bic****@gmail.com', 'Diana Hurtado');
$mail->addAddress($correo_recibe, 'Marcela Gomez');
$mail->Subject = '¡Alguien encontró tu bici!';
$mail->msgHTML("<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<title>Título</title>
</head>
<body>
Hola! ".$nombre.", desde BiciBogotá queremos informarte que al parecer alguien ha encontrado tu bici. Éstos fueron los datos que nos proporcionó: <br>
Datos de la bici
Serial: ".$serial."<br>
Marca: ".$marca."<br>
Dónde lo encontró?
Localidad: ".$nombre_localidad."<br>
Barrio: ".$nombre_barrio."<br>
Direccion: ".$direccion."<br><br>
Mensaje adicional: ".$mensaje."<br>
Si este mensaje ha sido de utilidad y has recuperado tu bicicleta reportalo <a href=".$link.">¡AQUÍ!</a><br>
(o copia y pega este link: ".$link."),<br>
de esta manera ya no aparecerá más en la sección de bicicletas perdidas de tu perfil y no tendrás problemas con lo retenes de la ciudad.
</body>
</html>");
if (!$mail->send()) {
echo "Ha ocurrido un error, el mensaje no ha sido enviado: " . $mail->ErrorInfo;
} else {
echo $mail->ErrorInfo."enviado";
}
And the error I get:
SERVER -> CLIENT: 220 smtp.gmail.com ESMTP c29sm4865365uaa.50 - gsmtp
2017-10-24 04:30:58 CLIENT -> SERVER: EHLO localhost
2017-10-24 04:30:58 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [186.155.14.49]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2017-10-24 04:30:58 CLIENT -> SERVER: STARTTLS
2017-10-24 04:30:58 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
SMTP Error: Could not connect to SMTP host.
2017-10-24 04:30:58 CLIENT -> SERVER: QUIT
2017-10-24 04:30:59
2017-10-24 04:30:59
SMTP Error: Could not connect to SMTP host.
Message could not be sent.Mailer Error: SMTP Error: Could not connect to SMTP host.
I have enabled less secure applications in Gmail, I also have the correct password and mail; I have also enabled and disabled the extension line openssl.dll from php.ini in Xampp I tried a million things even downloading cURL (as it was in an error page) I really know that PHPMailer is the most recommended to send emails and Gmail among the best servers however errors one day are corrected and the other nothing works .
Guys, I really need your help, I've been with them for quite some time. I do not know what to do anymore
Thanks in advance.