Phpmailer to Use Gmail as Smtp Server.Could Not Connect to Smtp Host. Mailer Error: Smtp Error: Could Not Connect to Smtp Host

PHPMailer to use Gmail as SMTP server.Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host

in you php.ini make sure you have uncommented the line with

extension=php_openssl.dll

PHPMailer + smtp.gmail.com : Could not connect to SMTP host

Just Add the following codes before line code $mail->SMTPDebug saves the day

$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);

xampp + PHPMailer + Gmail = SMTP Error: Could not connect to SMTP host

This is nothing to do with OAuth. You’ve got a much earlier issue at the TLS level. Either you’re missing the openssl extension, it’s misconfigured, or your CA certificates are out of date.

This issue is covered in the troubleshooting guide the error links to - check using openssl.

PHPMailer: Could not connect to SMTP host

$mailer->Host = 'ssl://smtp.gmail.com:465';

How to resolve 'SMTP Error: Could not connect to SMTP host.' in phpmailer?

First of all, while initiating PHPMailer send in the parameter true like,

$mailer = new PHPMailer(true);

This will help you to catch and handle exceptions.

Secondly, try this

$mailer->SMTPSecure = 'ssl'; // instead of tls


Related Topics



Leave a reply



Submit