Title: Server Closes Connection Unexpectedly
Last modified: September 20, 2017

---

# Server Closes Connection Unexpectedly

 *  Resolved [andaluzmedia](https://wordpress.org/support/users/andaluzmedia/)
 * (@andaluzmedia)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/server-closes-connection-unexpectedly/)
 * Hi Support,
 * Thanks for the free plugin.
 * I am currently experiencing a strange issue where the server is closing the connection
   prior to any mail being sent. There appears to be no verification issue, or readable
   errors that I can see. It’s very strange indeed.
 * **
    Server Info:
   
    OS: Linux srv2200.local.ltd 2.6.32-504.30.3.el6.x86_64 #1 
   SMP Wed Jul 15 10:13:09 UTC 2015 x86_64 PHP version: 5.6.31 WordPress version:
   4.8.2 WordPress multisite: Yes openssl: Available allow_url_fopen: Enabled stream_socket_client:
   Available fsockopen: Available cURL: Available cURL Version: 7.38.0, OpenSSL/
   1.0.1e
 * **Output from test email:** (I have replaced our server IP and domain with placeholders)
 * 2017-09-20 14:32:05 Connection: opening to ssl://smtp.gmail.com:465, timeout=
   300, options=array ( ‘ssl’ => array ( ‘verify_peer’ => false, ‘verify_peer_name’
   => false, ‘allow_self_signed’ => true, ),)
    2017-09-20 14:32:05 Connection: opened
   2017-09-20 14:32:05 SMTP -> get_lines(): $data is “” 2017-09-20 14:32:05 SMTP-
   > get_lines(): $str is “220 smtp.gmail.com ESMTP t4sm941993edc.42 – gsmtp” 2017-
   09-20 14:32:05 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP t4sm941993edc.42 – 
   gsmtp 2017-09-20 14:32:05 CLIENT -> SERVER: EHLO mydomain.com 2017-09-20 14:32:
   05 SMTP -> get_lines(): $data is “” 2017-09-20 14:32:05 SMTP -> get_lines(): 
   $str is “250-smtp.gmail.com at your service, [1.2.3.4]” 2017-09-20 14:32:05 SMTP-
   > get_lines(): $data is “250-smtp.gmail.com at your service, [1.2.3.4]” 2017-
   09-20 14:32:05 SMTP -> get_lines(): $str is “250-SIZE 35882577” 2017-09-20 14:
   32:05 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [1.2.3.4]
   250-SIZE 35882577” 2017-09-20 14:32:05 SMTP -> get_lines(): $str is “250-8BITMIME”
   2017-09-20 14:32:05 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your
   service, [1.2.3.4]250-SIZE 35882577250-8BITMIME” 2017-09-20 14:32:05 SMTP -> 
   get_lines(): $str is “250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER
   XOAUTH” 2017-09-20 14:32:05 SMTP -> get_lines(): $data is “250-smtp.gmail.com
   at your service, [1.2.3.4]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2
   PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH” 2017-09-20 14:32:05 SMTP -> get_lines():
   $str is “250-ENHANCEDSTATUSCODES” 2017-09-20 14:32:05 SMTP -> get_lines(): $data
   is “250-smtp.gmail.com at your service, [1.2.3.4]250-SIZE 35882577250-8BITMIME250-
   AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES”
   2017-09-20 14:32:05 SMTP -> get_lines(): $str is “250-PIPELINING” 2017-09-20 
   14:32:05 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [
   1.2.3.4]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN
   OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING” 2017-09-20 14:32:05 
   SMTP -> get_lines(): $str is “250-CHUNKING” 2017-09-20 14:32:05 SMTP -> get_lines():
   $data is “250-smtp.gmail.com at your service, [1.2.3.4]250-SIZE 35882577250-8BITMIME250-
   AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-
   PIPELINING250-CHUNKING” 2017-09-20 14:32:05 SMTP -> get_lines(): $str is “250
   SMTPUTF8” 2017-09-20 14:32:05 SERVER -> CLIENT: 250-smtp.gmail.com at your service,[
   1.2.3.4]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN
   OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
   2017-09-20 14:32:05 Auth method requested: XOAUTH2 2017-09-20 14:32:05 Auth methods
   available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH
   2017-09-20 14:32:05 CLIENT -> SERVER: QUIT 2017-09-20 14:32:05 SMTP -> get_lines():
   $data is “” 2017-09-20 14:32:05 SMTP -> get_lines(): $str is “221 2.0.0 closing
   connection t4sm941993edc.42 – gsmtp” 2017-09-20 14:32:05 SERVER -> CLIENT: 221
   2.0.0 closing connection t4sm941993edc.42 – gsmtp 2017-09-20 14:32:05 Connection:
   closed
 * I have tried both SSL and TLS, also revoking + reauthenticating the permissions.
 * Please advise – thanks.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Noor Alam](https://wordpress.org/support/users/naa986/)
 * (@naa986)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/server-closes-connection-unexpectedly/#post-9515800)
 * Hi, It’s hard to troubleshoot this since there is no error in the log. Have you
   tried TLS on port 587? Who is your hosting provider?
 *  Thread Starter [andaluzmedia](https://wordpress.org/support/users/andaluzmedia/)
 * (@andaluzmedia)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/server-closes-connection-unexpectedly/#post-9516259)
 * Hi there,
 * Yes I used TLS as default due to it being the newer technology, and only tested
   SSL out of pure curiosity.
 * I appear to have the identical problem to the guy in the other support thread
   who has posted earlier today, as it closes the connection without any explanation/
   error.
 * Hopefully we can find a resolution.
 *  Thread Starter [andaluzmedia](https://wordpress.org/support/users/andaluzmedia/)
 * (@andaluzmedia)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/server-closes-connection-unexpectedly/#post-9516467)
 * We’re using a dedicated server with the ISP NForce.
 *  Plugin Author [Noor Alam](https://wordpress.org/support/users/naa986/)
 * (@naa986)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/server-closes-connection-unexpectedly/#post-9530123)
 * [https://wordpress.org/support/topic/refresh-token-bug-i-will-rate-you-5-stars-if-fixed/](https://wordpress.org/support/topic/refresh-token-bug-i-will-rate-you-5-stars-if-fixed/)
 * If you continue to have this issue you can downgrade to version 1.1.2 before 
   the Google API Client library got updated in the plugin:
 * [https://wordpress.org/plugins/gmail-smtp/advanced/](https://wordpress.org/plugins/gmail-smtp/advanced/)

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Server Closes Connection Unexpectedly’ is closed to new replies.

 * ![](https://ps.w.org/gmail-smtp/assets/icon-128x128.png?rev=2432932)
 * [Gmail SMTP](https://wordpress.org/plugins/gmail-smtp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gmail-smtp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gmail-smtp/)
 * [Active Topics](https://wordpress.org/support/plugin/gmail-smtp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gmail-smtp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gmail-smtp/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Noor Alam](https://wordpress.org/support/users/naa986/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/server-closes-connection-unexpectedly/#post-9530123)
 * Status: resolved