(please specify the website or account you are asking about)
Error Message
error 110 can’t connect to host
Other Information
<?php
//my code
//include phpmailers files
require('includes/PHPMailer.php');
require('includes/Exception.php');
require('includes/SMTP.php');
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\PHPmailer;
$mail = new PHPmailer();
$mail->SMTPDebug = 3;
$mail->isSMTP();
$mail->Mailer= "smtp";
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username= '[email protected]';
$mail->Password = 'xxxxxx';
$mail->SMTPSecure = 'tls';
$mail->port = '587';
$mail->setFrom("[email protected])");
$mail->addAddress('[email protected]'); // Name is optional
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'text ';
$mail->Body = 'This is the HTML message body <b>HELLO WORLD</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
$mail->smtpClose();
?>
Can you change the Debug constant to 4 instead of 3? Then, share the logs here, but be sure to hide your email and password, as those will be displayed with the most verbose logging level.
It’s already fixed , I’ve Just changed the host value to “tls://smtp.gmail.com:587” and erase $mail->Port
I don’t know if Is it okay to set it that way but it worked. Thanks a lot guys:fire: