Phpmailer: CLIENT: 220 2.0.0 Ready to start TLS -> SMTP Error: Could not connect to SMTP host.

Created on 20 Jul 2016  路  3Comments  路  Source: PHPMailer/PHPMailer

I need help with this error:

DNS is ok.
Allow less secure apps is enabled.
openssl is loaded.

Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
Connection: opened
SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is "220 smtp.gmail.com ESMTP l129sm2173247qke.27 - gsmtp"
SERVER -> CLIENT: 220 smtp.gmail.com ESMTP l129sm2173247qkf.27 - gsmtp
CLIENT -> SERVER: EHLO www.abcdefgh.com
SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is "250-smtp.gmail.com at your service, [000.000.000.000]"
SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [000.000.000.000]"
SMTP -> get_lines(): $str is "250-SIZE 35882577"
SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [000.000.000.000]250-SIZE 35882577"
SMTP -> get_lines(): $str is "250-8BITMIME"
SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [000.000.000.000]250-SIZE 35882577250-8BITMIME"
SMTP -> get_lines(): $str is "250-STARTTLS"
SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [000.000.000.000]250-SIZE 35882577250-8BITMIME250-STARTTLS"
SMTP -> get_lines(): $str is "250-ENHANCEDSTATUSCODES"
SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [000.000.000.000]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES"
SMTP -> get_lines(): $str is "250-PIPELINING"
SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [000.000.000.000]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING"
SMTP -> get_lines(): $str is "250-CHUNKING"
SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [000.000.000.000]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING"
SMTP -> get_lines(): $str is "250 SMTPUTF8"
SERVER -> CLIENT: 250-smtp.gmail.com at your service, [000.000.000.000]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
CLIENT -> SERVER: STARTTLS
SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is "220 2.0.0 Ready to start TLS"
SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
SMTP Error: Could not connect to SMTP host.
CLIENT -> SERVER: QUIT
SMTP -> get_lines(): $data is ""

Connection: closed
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

All 3 comments

If you follow that link to the troubleshooting guide, it will tell you how to deal with this.

This error is with PHP Version 7.0.6.
If I change PHP to 5.6.17, it works.

I really don't know what's wrong....

Do what it says in the guide. That will allow you to work out what is missing or wrong with your config. It's quite likely to be something like a missing CA file in your PHP 7 config.

Was this page helpful?
0 / 5 - 0 ratings