I am getting an almost identical error message:
Connection: opening to smtp.gmail.com:587, timeout=300, options=array ( ‘ssl’ => array ( ‘verify_peer’ => false, ‘verify_peer_name’ => false, ‘allow_self_signed’ => true, ),)
Connection: Failed to connect to server. Error number 2. “Error notice: stream_socket_client(): unable to connect to smtp.gmail.com:587 (Network is unreachable)
SMTP ERROR: Failed to connect to server: Network is unreachable (101)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
I have used https://www.yougetsignal.com/tools/open-ports/ to verify ports 587 and 465 are open. I’ve tried both and both produce the same error message.
Server Info:
OS: Linux host422.hostmonster.com 3.10.0-427.36.1.lve1.4.45.el6h.x86_64 #1 SMP Tue Apr 4 18:04:46 EDT 2017 x86_64
PHP version: 5.6.29
WordPress version: 4.8
WordPress multisite: No
openssl: Available
allow_url_fopen: Enabled
stream_socket_client: Available
fsockopen: Available
cURL: Available
cURL Version: 7.24.0, OpenSSL/1.0.0