Help I have this problem in my code, who helps me please this is the code:
function send_mail($email,$message,$subject)
{
require_once('mailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->Mailer = "smtp";
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->AddAddress($email);
$mail->Username="micorreo";
$mail->Password="micontraseña";
$mail->SetFrom('[email protected]','Coding Cage');
$mail->AddReplyTo("[email protected]","Coding Cage");
$mail->Subject = $subject;
$mail->MsgHTML($message);
$mail->Send();
if(!$mail->Send()) {
echo "Error: " . $mail->ErrorInfo;
} else {
echo "Enviado!";
}
}
It generates the following error:
SMTP Error: Could not connect to SMTP host.