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
Sending/Displaying a Base64 Encoded Image
MySQL Group by and Fill Empty Rows
Utf-8 Not Working in HTML Forms
Why Can't I Access the Array with Index Directly
Modify an Existing PHP Function to Return a String
How to Parse Fixed Width Column Text in PHP
Phpmailer Character Encoding Issues
What Is the Use of <<<Eod in PHP
Auto Increment Skipping Numbers
When and Where Should I Use Session_Start
Mysql_Fetch_Array Returns Duplicate Data
Using Gcm to Send Notifications on App, Returns Invalidregistration Error
How to Do Url Rewriting in PHP
Accessing Arrays Whitout Quoting the Key