Could not connect to the SMTP host.
My code:
<?php
require_once ("phpmailer\class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->Username = "hsjdtzsjnsu@gmail.com";
$mail->Password = "***********";
$mail->SetFrom('hsjdtzsjnsu@gmail.com','shadi');
$mail->FromName = "From";
$mail->AddAddress("info@abolfazl.dev");
$mail->Subject = "Email Test";
$mail->Body = "<H3>Email Sent ...............</H3>";
$mail->IsHTML (true);
if (!$mail->Send())
{
echo "Error: $mail->ErrorInfo";
}
else
{
echo "Message Sent!";
}
?>
well google that error notice, so many possible reasons
there is an option for dbug. I don't remember, but is something like $mail->debug( level ) . With that you can see what kind if error is
Обсуждают сегодня