Gmail SMTP Plugin for WordPress

Last updated on by admin

Gmail SMTP is an advanced SMTP mailing plugin for WordPress for sending an email via Gmail SMTP server. Unlike most SMTP plugins It uses the OAuth 2.0 protocol to authorize access to the Gmail API instead of password authentication.

Gmail SMTP Benefits

1. Gmail SMTP plugin does not store your password. It uses the OAuth 2.0 mechanism for SMTP authentication. It means a more secure login system for users.

2. Gmail SMTP plugin uses PHPMailer – a very popular PHP library used in the core WordPress for sending an email. This is to make sure that users can still get full benefits of the default email functionality.

3. Gmail SMTP plugin takes a big headache away from you because you no longer need to Allow Less Secure Apps on your Gmail account. This is an option that users had to enable in order to fix SMTP connection issue. This issue went viral from December 2014, when Google started imposing OAuth 2.0 authentication to access their apps. This option affects SMTP mailing because applications that perform password authentication to IMAP, POP, or SMTP are considered Less Secure Apps.

As far as I know, this issue still affects almost all the SMTP plugins out there.

How OAuth 2.0 Authorization Works

1. You register a web application in the Google Developers Console.

2. When this application is launched it requests that you give it access to data in your Google account.

3. If you consent, the application receives credentials to access the API.

Requirements

  1. PHP 5.6 or later
  2. A Gmail Account
  3. A self-hosted WordPress site

Gmail SMTP Info

Plugin Name: Gmail SMTP
Version: 1.1.5
File Format: application/zip
Requires: WordPress 4.8
Rating: 4.2 based on 50 votes
See All Ratings/Submit Your Rating Here
Price: 0 USD

Installation

You can install the Gmail SMTP plugin in one of the following ways:

Option 1 (Quick & Easy install)

  1. Go to Plugins->Add New from your WordPress admin dashboard
  2. Search for Gmail SMTP
  3. Click Install once you have found it

Option 2 (Manual install)

  1. Download the zip version of the plugin
  2. Go to Plugins->Add New
  3. Click Upload Plugin
  4. Select the zip file on your computer
  5. Install it

Gmail SMTP Configuration

In order to get started with the plugin go to Settings->Gmail SMTP from your admin dashboard.

screenshot of gmail smtp plugin menu

1. Go to console.developers.google.com.

2. Login to your Google account which will be used to send an email.

3. Create a new project where your application will be registered.

screenshot showing how to create a new project in the Google Developers Console

It doesn’t have to be “Gmail SMTP Project 1”. You can name it whatever you like. I chose a meaningful name because I have multiple projects in it.

4. Once the project is created Click on the ENABLE API button.

screenshot showing how to enable an API on a project in Google Developers Console

If you have multiple projects make sure that the right project is selected in the drop down menu.

5. Select Gmail API under “G Suite APIs”.

screenshot showing how to select Gmail API for a project in Google Developers Console

6. This will show you more information as to what you can do by enabling Gmail API. Click Enable.

screenshot showing how to enable Gmail API on a project in Google Developers Console

7. Now that you have enabled this API you need to create credentials to use it. So go to the Credentials tab.

screenshot showing how to create credentials for Gmail API in Google Developers Console

8. Select OAuth Client ID when you are creating these credentials.

screenshot showing how to create OAuth Client ID for an API in Google Developers Console

9. In order to create an OAuth client ID, you need to set a product name first. So click Configure consent screen.

screenshot showing how to configure the consent screen when creating an OAuth Client ID

10. Enter a product name (e.g. Gmail SMTP) and a privacy policy page URL for the OAuth consent screen and click Save.

screenshot showing the oauth consent screen in the google developers console

11. Now that the OAuth consent screen has been configured you can create an OAuth Client ID. Set the application type to Web application and enter a name for it (e.g. Gmail SMTP App).

12. Copy the Authorized Redirect URL from the settings and paste it into the field here.

screenshot showing how to create a client id by creating a new web app in the google developers console

13. Click Create. This will generate a Client ID and Client Secret for you. Copy and paste them into the settings area of the plugin.

14. Configure the rest of the settings. It includes,

OAuth Email Address: The email address that you will use for SMTP authentication. This should be the same email used in the Google Developers Console.

From Email Address: The email address which will be used as the From Address when sending an email.

From Name: The name which will be used as the From Name when sending an email.

Type of Encryption: The encryption which will be used when sending an email (either TLS/SSL). By default, it should be set to TLS since SSL has been deprecated since 1998.

SMTP Port: The port which will be used when sending an email. If you choose TLS it should be set to 587. For SSL use port 465 instead.

15. Click Save Changes.

Now that you have configured the settings a Grant Permission button will appear.

screenshot showing how to grant permission from the gmail smtp settings

16. Clicking on it will take you to a consent screen where you will be able to grant this app access to the Gmail API.

allow application screen of google developers console

17. When you click Allow you will get redirected back to the plugin settings. You should see a message like Access Granted Successfully. The SMTP Status should also get set from Not Connected to Connected.

screenshot of gmail smtp settings

That’s it. Gmail SMTP plugin will now be able to take control of all outgoing email from your website.

Test Email

In order to test the email functionality, you can send a test email from the Test Email tab.

Debug option is enabled by default for the test email functionality – which means you would be able to see if the plugin was able to send the email without any error.

screenshot showing how to send a test email from the gmail smtp plugin settings

Troubleshooting

By default, your SMTP port should be configured on 587 (with TLS encryption). If you can’t get it to work then you can try changing it to 465 (with SSL encryption).

If you still can’t get either to work try port 25 with TLS first and then SSL. Please note that most servers don’t support encryption on port 25, which is why port 587 and 465 are the preferred options.

smtp connect() failed

If you are connecting to the Gmail SMTP server for the first, you might get an error: smtp connect() failed or Could not authenticate.

This error usually occurs when Gmail blocks an SMTP connection made from an external server. This is not a configuration issue. Gmail does it time to time for security reasons. In order to fix this issue login to your Gmail account first. You should see a security warning from Gmail upon login – “Your account has been hacked” or “Somebody stole your password”. As soon as you confirm that it was you who tried to log in (Just click on the link that shows up in that message), the plugin should be able to connect to the Gmail SMTP server.

Error Invalid Scope

Google recently enhanced their risk assessment for new web applications that request user data. Based on this risk assessment, some web applications will require a manual review before users can approve data permissions. Until the review is complete, unverified apps will display an “invalid_scope” or some other random error messages when you go to the permissions consent page.

If you are getting this type of error when setting up the plugin you can join this Google group Risky Access Permissions By Unreviewed Apps. This will automatically approve data access to the app from your account and you won’t have to go through their manual review process (which includes filling out a developer verification form). This automatic approval process is permissible by Google for testing/personal use/sending email through WordPress Plugins/similar single-account SMTP usage (See this page for more details).

Error This app isn’t verified

If you see this error when trying to authorize your app to read, send, delete, and manage your email, you can manually get around the error screen. See OAuth Client Verification for details.

Error refreshing the OAuth2 token

This is an intermittent issue that seems to occur on some servers. When you get this error, it means that the plugin is not being able to refresh the OAuth2 token using the secret access key. It is required by the App that you created in your account to access the Gmail API. Usually, the issue goes away when you delete the existing secret access key from the database and do a fresh authorization. For details please check the “Fresh Authorization” section.

OpenSSL Certificate Verification Failure

As of PHP 5.6, you will get the following error/warning if the SSL certificate on the server is not properly configured:

Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

In order to fix this issue, your web host needs to replace this invalid, misconfigured or self-signed certificate with a good one. The other alternative is to check this option in the settings so PHP doesn’t verify the certificate – “Disable SSL Certificate Verification”. That said, I wouldn’t recommend it since this change was made for a good reason.

We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail

Peer certificate CN=’example.com’ did not match expected CN=’smtp.gmail.com’

One of these errors is usually seen when your web server tries to connect to a different remote server instead of smtp.gmail.com. This can be easily found by checking the debug line where the server is communicating with the remote client. For example,

2017-10-10 00:16:56 SERVER -> CLIENT: 220-example.com ESMTP Exim

Why does this issue occur?

You may have this setting on your web server – “Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)” that is set to “YES”. It needs to be “NO”.

If you are not sure, contact your web host instead of making any changes so they can troubleshoot this issue for you.

Fresh Authorization / Removing Access From the Application

For some reason, if you ever want to stop using this plugin or do a fresh authorization this option might come in handy.

Revoke Access menu allows you to remove access from a previously authorized application.

screenshot showing the revoke access settings of gmail smtp plugin

First, you need to click on the account settings link. This will take you to a page where you can remove access from the Gmail SMTP application.

screenshot showing how to remove access from an application in the google developers console

Once you have removed access from it, go back to the Remove Access tab in the plugin settings and delete the Access key.

Access key is a token received by the plugin when you first granted your app access to the Gmail API. This token is needed to communicate with the Gmail API and send an email. In order to avoid any confusion, the plugin does not show it on the settings page.

Once this token is deleted the plugin can no longer connect to the Gmail SMTP server or send an email. This means you will need to reauthorize (using the web application link in the settings) before you can start using the plugin again. However, you won’t need to set up everything from scratch as long as the project still exists in your Google Developers Console.

If you have any questions feel free to share it in the comment section.

If you like Gmail SMTP please leave it a rating. A huge thanks in advance!
GET a Special 60% OFF WordPress Hosting Here

348 thoughts on “Gmail SMTP Plugin for WordPress”

  1. Hello Admin,

    Great plugin Thank you..

    Question: When someones uses my form to send me emails I get the email but when I try to reply to it.. its from myself email address .. so it repeats my email .. How can I fix this so it shows the other person email address and I can just reply to it?

    Thank you

    1. @Marios, When using SMTP you are basically sending an email from your account to the recipient (Not from the contact form on your server). That’s why Gmail is automatically putting your actual Gmail address as the reply-to email. That same goes for From email address. The plugin does pass this information to Gmail but it simply ignores them for security reasons.

  2. Any thoughts on why this is failing? I do get the notification that GMAIL STMP is controlling the email and I should remove it. There was no option to approve.

    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. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    Servo Info:
    OS: Linux box1085.bluehost.com 3.12.74-20170619.148.ELK6.x86_64 #1 SMP Mon Jun 19 19:48:05 CDT 2017 x86_64
    PHP version: 5.6.29
    WordPress version: 4.8.1
    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

    Thanks,
    George

    1. @George, Bluehost may have blocked port 587 on your server. Please contact them to make sure port 587 is open and supports TLS encryption.

      1. I get the same error with port 465 and I have had other smtp plugins that I could get test emails through port 465.

        Thanks,
        George

      2. I am also getting this error. Tried 587, 465, 25 with SSL and TLS, no dice. Always get:

        unable to connect to ssl://smtp.gmail.com:25 (Network is unreachable)

        Any help guys?

        1. @Tim, Port 25 usually doesn’t support encryption. Please try TLS encryption on port 587. You also need to contact your host to make sure that port 587 is open and supports TLS encryption.

  3. This morning, I got one test email on port 587 through. It took a while, but it came through. All other tests this morning on port 587 and 465 have all had timeout errors. I guess the bluehost site or gmail server is just very slow.

    Thanks,
    George

  4. Hello, Gmail SMTP seems to conflict with the Use-Your-Drive plugin, which is using V3 of the google api. Is there any way to get Gmail SMTP to use V3 as well? See this link for more info: florisdeleeuwnl.zendesk.com/hc/en-us/articles/214584903-Error-400-Invalid-field-selection

    Thanks!

  5. Love you, you helped me solve a problem for my woocommerce sending out automatic email through GSuite! Huge thanks!!!!

    1. What hosting provider are you using – if you don’t mind me asking. I would like to use the same workflow with my wpforms, but 1and1 hosting provider does not play nice with gmail SMTP. Looking to jump ship on 1and1

  6. 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 (Connection timed out)
    SMTP ERROR: Failed to connect to server: Connection timed out (110)
    SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    I had a successful install of the gmail plugin , green connected ready to go and I get this error from my test email. I am running debian 8. Any suggestions? Do I need to still install postfix or another smtp mail app on debian???

    1. All I needed was my vps to open port 587 , my gmail plugin works per the debug, but my email notification on my other plugin isnt working. Thanks for the no-reply

      1. @Brad, All the information is available in the “Troubleshooting” section. It’s not always possible to guess exactly what is causing the connection error. You will need to follow it step by step.

  7. How many “OAuth 2.0 client IDs” can I have on a project because currently, I have 37 client IDs on a project and anytime I try to add a new one, I get an error.

  8. Hello,

    I got this error just now.

    Fatal error: Call to undefined function GuzzleHttp\Handler\curl_reset() in /home3/boyiboyi/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 78

    What should I do?

    Thanks

    1. @Boyi, I had to update the Google API Client library today since it was conflicting with so many popular plugins. One of many changes in this version is Guzzle which is a PHP HTTP client that Google now uses to send HTTP requests. The error is actually coming from it (not the plugin). I believe it’s because there is something wrong with cURL setup on your server. Please copy and paste the content from the “Server Info” so I can take a look.

      1. I’m receiving this same :

        Server Info:
        OS: Linux a2plcpnl0352.prod.iad2.secureserver.net 2.6.32-673.26.1.lve1.4.29.el6.x86_64 #1 SMP Tue Jun 20 13:27:00 EDT 2017 x86_64
        PHP version: 5.4.45
        WordPress version: 4.8.1
        WordPress multisite: No
        openssl: Available
        allow_url_fopen: Enabled
        stream_socket_client: Available
        fsockopen: Available
        cURL: Available
        cURL Version: 7.38.0, OpenSSL/1.0.1e

      2. Thanks for responding. As always, great plugin!

        Here is the Server Info:
        OS: Linux gator4104.hostgator.com 3.12.74-213.ELK6.x86_64 #1 SMP Tue Jun 20 00:36:01 CDT 2017 x86_64
        PHP version: 5.4.45
        WordPress version: 4.8.1
        WordPress multisite: No
        openssl: Available
        allow_url_fopen: Enabled
        stream_socket_client: Available
        fsockopen: Available
        cURL: Available
        cURL Version: 7.19.7, NSS/3.27.1

          1. @Boyi, Glad to hear that the issue is fixed now. So PHP version was the issue. Not sure why Google stated in their documentation that 5.4 is enough to run their API client library. I believe they need to update their documentation.

  9. I have the same problem:

    ( ! ) Fatal error: Uncaught GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see curl.haxx.se/libcurl/c/libcurl-errors.html) in D:\softaculous\www\acoefibolsa\wp-content\plugins\gmail-smtp\google-api-php-client\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 187
    ( ! ) GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see curl.haxx.se/libcurl/c/libcurl-errors.html) in D:\softaculous\www\acoefibolsa\wp-content\plugins\gmail-smtp\google-api-php-client\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 187
    Call Stack
    # Time Memory Function Location
    1 0.0830 3961248 {main}( ) …\options-general.php:0
    2 0.0840 4008488 require_once( ‘D:\softaculous\www\acoefibolsa\wp-admin\admin.php’ ) …\options-general.php:10
    3 0.0840 4022552 require_once( ‘D:\softaculous\www\acoefibolsa\wp-load.php’ ) …\admin.php:31
    4 0.0850 4034440 require_once( ‘D:\softaculous\www\acoefibolsa\wp-config.php’ ) …\wp-load.php:37
    5 0.0850 4123976 require_once( ‘D:\softaculous\www\acoefibolsa\wp-settings.php’ ) …\wp-config.php:92
    6 1.1751 45621224 do_action( ) …\wp-settings.php:448
    7 1.1751 45621520 WP_Hook->do_action( ) …\plugin.php:453
    8 1.1751 45621544 WP_Hook->apply_filters( ) …\class-wp-hook.php:323
    9 1.2911 49855712 GMAIL_SMTP->plugin_init( ) …\class-wp-hook.php:298
    10 1.3041 50890768 GmailXOAuth2::resetCredentials( ) …\main.php:144
    11 1.3051 50999080 Google_Client->authenticate( ) …\class.phpmaileroauthgoogle.php:99
    12 1.3051 50999080 Google_Client->fetchAccessTokenWithAuthCode( ) …\Client.php:170
    13 1.3181 51704712 Google\Auth\OAuth2->fetchAuthToken( ) …\Client.php:191
    14 1.3221 51802744 Google\Auth\HttpHandler\Guzzle6HttpHandler->__invoke( ) …\OAuth2.php:492
    15 1.3221 51802792 GuzzleHttp\Client->send( ) …\Guzzle6HttpHandler.php:34
    16 1.3781 51935184 GuzzleHttp\Promise\RejectedPromise->wait( ) …\Client.php:106

  10. I just upgraded to version 1.1.5 of Gmail SMTP and now my emails are no longer sending. I get a warning at the top that GMail SMTP requires PHP 5.6 (which my hosting provider does not have on my server, 5.5 is the highest).

    How do I resolve this, or will I have to find another product?

    Cheers

    1. @Dave, You could download and install an older version of the plugin (1.1.2) that includes the legacy Google API Client library: https://wordpress.org/plugins/gmail-smtp/advanced/

      I had to update the Google API Client library recently since it was conflicting with so many popular plugins. Unfortunately, in this version, the Google API Client library triggers a “curl_reset()” error unless the server is running on PHP 5.6 or higher. I added that warning notice so users don’t have to troubleshoot why that error is occurring on their sites.

  11. I recently configured the Plugin and am getting the following error when sending Test Emails…

    InvalidArgumentException thrown
    Invalid token format

    Here is the server info:
    Gmail SMTP 1.1.5
    WordPress 4.8.1
    OS: Linux xxxxxxxxx 3.13.0-76-generic #120-Ubuntu SMP Mon Jan 18 15:58:41 UTC 2016 i686
    PHP version: 7.0.22-0ubuntu0.16.04.1
    WordPress version: 4.8.1
    WordPress multisite: No
    openssl: Available
    allow_url_fopen: Enabled
    stream_socket_client: Available
    fsockopen: Available
    cURL: Available
    cURL Version: 7.47.0, OpenSSL/1.0.2g

    Please help!

  12. 2017-09-06 08:56:19 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [205.144.171.101]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2017-09-06 08:56:19 Auth method requested: XOAUTH2
    2017-09-06 08:56:19 Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH
    2017-09-06 08:56:19 CLIENT -> SERVER: QUIT
    2017-09-06 08:56:19 SMTP -> get_lines(): $data is “”
    2017-09-06 08:56:19 SMTP -> get_lines(): $str is “221 2.0.0 closing connection 188sm2174727pfe.171 – gsmtp”
    2017-09-06 08:56:19 SERVER -> CLIENT: 221 2.0.0 closing connection 188sm2174727pfe.171 – gsmtp
    2017-09-06 08:56:19 Connection: closed

    Fatal error: Uncaught exception ‘InvalidArgumentException’ with message ‘Invalid token format’ in H:\root\home\backslash-001\www\kainosafrica\wp-content\plugins\gmail-smtp\google-api-php-client\src\Google\Client.php:434 Stack trace: #0 H:\root\home\backslash-001\www\kainosafrica\wp-content\plugins\gmail-smtp\class.phpmaileroauthgoogle.php(138): Google_Client->setAccessToken(‘{“error”:”inval…’) #1 H:\root\home\backslash-001\www\kainosafrica\wp-content\plugins\gmail-smtp\PHPMailer\class.smtp.php(470): GmailXOAuth2->getOauth64() #2 H:\root\home\backslash-001\www\kainosafrica\wp-content\plugins\gmail-smtp\class.phpmaileroauth.php(153): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”, Object(GmailXOAuth2)) #3 H:\root\home\backslash-001\www\kainosafrica\wp-content\plugins\gmail-smtp\PHPMailer\class.phpmailer.php(1540): PHPMailerOAuth->smtpConnect(Array) #4 H:\root\home\backslash-001\www\kainosafrica\wp-content\plugins\gmail-smtp\PHPMailer\class.phpmailer.php(1335): PHPMailer->smtpSend(‘Date: Wed, 6 Se…’, ‘test\n’) #5 H:\root\h in H:\root\home\backslash-001\www\kainosafrica\wp-content\plugins\gmail-smtp\google-api-php-client\src\Google\Client.php on line 434

  13. Here are my Server Information

    OS: Windows NT WIN5101 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) i586
    PHP version: 5.6.27
    WordPress version: 4.8.1
    WordPress multisite: No
    openssl: Available
    allow_url_fopen: Enabled
    stream_socket_client: Available
    fsockopen: Available
    cURL: Available
    cURL Version: 7.50.3, OpenSSL/1.0.2j

  14. Hello, can anybody help me with this problem: I’ve tried requesting new credentials, but still no luck

    400. That’s an error.

    Error: redirect_uri_mismatch

    The redirect URI in the request, http://www.cymortho.co.uk/wp-admin/options-general.php?page=gmail-smtp-settings&action=oauth_grant, does not match the ones authorized for the OAuth client. Visit https://console.developers.google.com/apis/credentials/oauthclient/899255158133-kc64969jk6g24927q1h8cuefhsl16n50.apps.googleusercontent.com?project=899255158133 to update the authorized redirect URIs.

    Sorry, not a coder, so be gentle with me!!
    Thanks
    Hugh

    1. You need to:

      * Copy/paste your “Authorized redirect URIs” in Credentals > Your OAuth 2.0
      * Credentials > Domain Verification (add your domain there)

  15. In the setup window, we can enter “From Email Address”. When I test email, the OAuth email is the “from address”, not the address I entered in the “From Email Address” field.

    What am I doing wrong?

  16. Hello. I have this error, can’t find what to do.
    Fatal error: Uncaught exception ‘InvalidArgumentException’ with message ‘Invalid token format’ in /wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php:434 Stack trace: #0 /wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(138): Google_Client->setAccessToken(‘{“error”:”inval…’) #1 /wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php(470): GmailXOAuth2->getOauth64() #2 /wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(153): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”, Object(GmailXOAuth2)) #3 /wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1540): PHPMailerOAuth->smtpConnect(Array) #4 /wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1335): PHPMailer->smtpSend(‘Date: Tue, 12 S…’, ‘test\n’) #5 /wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1213): PHPMailer->postSend() #6 /wp-content/plugins/gmail-smtp/main.php(943): PHPMailer->send() #7 /wp-content/plugins/gmail-smtp/main.php(183): wp_mail(‘gosia@asiandive…’, ‘test 5’, ‘test’) #8 /wp-conten in /wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php on line 434

  17. Got it working, but it does not use my “From Address”, it uses my gmail account. What do I need to change?
    Attorneys4Law

    FROM Email set to:
    info@attorneys4law.co.za

    Cheers

  18. Dear Admin, I have been most satisfied with the plugin. After unfortunately upgrading today, the plugin doesn’t work due to the higher php minimum requirement, and my hosting company doesn’t want to upgrade it. It worked perfectly before.

    Could you please send me a download a link for the former version of the plugin or write an advice on what I should change in the code, so that the former version of the plugin could work? I hope I could edit the one or more necessary files in notepad++ or other coding software, or in wordpress itself in the “edit plugin” section, to get the minimum php back to where it was. I wish I wouldn’t have clicked on update.

    Thank you so very much indeed.

    This is the problem message I got after trying a test mail:

    wp-content/plugins/gmail-smtp/google-api-php-client/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 78

    1. On the Previous versons section of wordpress.org/plugins/gmail-smtp/advanced/ I cannot download the former 1.1.4, it only allows to download the the 1.1.2 as the latest of previous versions. I installed it originally on the 18th Aug, I am uncertain which was the latest version at that time? Could you so please send a download link to the version that was the latest one at that time? It would so much of a help, I would really appreciate it.

  19. UPDATE: I was successful, now it works with uploading the latest “older version” from wordpress.org/plugins/gmail-smtp/advanced

    However, as written above, it is the 1.1.2 version, and 1.1.4 version might be safer to use (I originally started using the plugin at the 18th Aug).
    So if there could be a downloading opportunity of 1.1.4, I would try it.

    Thank you very much indeed.

  20. Hi

    Same issues as Margot above.

    PHP Fatal error: Uncaught InvalidArgumentException: Invalid token format in /var/www/html/wordpress/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php:434\nStack trace:\n#0 /var/www/html/wordpress/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(138): Google_Client->setAccessToken(Array)\n#1 /var/www/html/wordpress/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php(470): GmailXOAuth2->getOauth64()\n#2 /var/www/html/wordpress/wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(152): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”, Object(GmailXOAuth2))\n#3 /var/www/html/wordpress/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1540): PHPMailerOAuth->smtpConnect(Array)\n#4 /var/www/html/wordpress/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1335): PHPMailer->smtpSend(‘Date: Sun, 17 S…’, ‘test\\n’)\n#5 /var/www/html/wordpress/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1213): PHPMailer->postSend()\n#6 /var/www/html/wordpress/wp-content/plugins/gmail-smtp/ in /var/www/html/wordpress/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php on line 434, referer: swnabt.com.au/wp-admin/options-general.php?page=gmail-smtp-settings&action=test-email

      1. @admin

        It’s ok i fixed it. I saw another post somewhere about refreshing the authentication. So I revoked access and refreshed the authentication token and it worked.

        Thanks

          1. I did this as well, but the problem started again a few days later. There is definitely an issue with the plugin.

      2. I am starting to see the same issue. Refreshing token will allow me send out one or two test mails. Then it stops working again.

        Mysql provides some additional information:
        mysql> select * from wp_options where option_name =”gmail_smtp_options”;

        9705 | gmail_smtp_options | a:9:{s:15:”oauth_client_id”;s:72:””;s:19:”oauth_client_secret”;s:24:””;s:18:”oauth_access_token”;s:74:”{“error”:”invalid_grant”,”error_description”:”Code was already redeemed.”}”;s:16:”oauth_user_email”;s:23:”@gmail.com”;s:10:”from_email”;s:23:”@gmail.com”;s:9:”from_name”;s:8:””;s:18:”type_of_encryption”;s:3:”tls”;s:9:”smtp_port”;s:3:”587″;s:24:”disable_ssl_verification”;s:0:””;} | yes

  21. I too am experiencing the same issues. When I try to login (Even when I try to go the plugins page in wp-admin) I get a 500 error. I tried to revoke and reauthenticate, and it did work for a time, but probably only a few days. It broke again, so I had to disable the plugin. I really want to use it, but I can’t because the error is confusing my users and causing other issues.

    Here is my system info:

    OS: Linux ip-###-##-##-## 4.4.0-1032-aws #41-Ubuntu SMP Mon Aug 14 13:08:44 UTC 2017 x86_64
    PHP version: 7.0.22-0ubuntu0.16.04.1
    WordPress version: 4.8.1
    WordPress multisite: No
    openssl: Available
    allow_url_fopen: Enabled
    stream_socket_client: Available
    fsockopen: Available
    cURL: Available
    cURL Version: 7.47.0, OpenSSL/1.0.2g

    Here is the error:

    Notice: Undefined index: refresh_token in /var/www/html/———————/wp-content/plugins/gmail-smtp/main.php on line 681

    Fatal error: Uncaught InvalidArgumentException: Invalid token format in /var/www/html/———————-/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php:434 Stack trace: #0 /var/www/html/———————-/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(138): Google_Client->setAccessToken(Array) #1 /var/www/html/———————-/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php(470): GmailXOAuth2->getOauth64() #2 /var/www/html/———————-/wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(152): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”, Object(GmailXOAuth2)) #3 /var/www/html/———————-/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1540): PHPMailerOAuth->smtpConnect(Array) #4 /var/www/html/———————-/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1335): PHPMailer->smtpSend(‘Date: Fri, 15 S…’, ‘This email was …’) #5 /var/www/html/———————-/wp-content/plug in /var/www/html/———————-/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php on line 434

    1. @nadine, When do you get this error? Do you also get an error message? Please copy and paste the content from the “Server Info” tab so I can take a look.

      1. Hi! When I try to send a test email.

        OS: Linux box670.bluehost.com 3.10.0-614.10.2.lve1.4.50.el6h.x86_64 #1 SMP Mon May 22 17:31:11 EDT 2017 x86_64
        PHP version: 7.0.12
        WordPress version: 4.8.2
        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

  22. I am still getting the following errors when sending test messages through the plugin…

    InvalidArgumentException thrown
    Invalid token format

    Would running PHP 7 cause this problem?

    1. @Andrew, The plugin has been tested in PHP 7.0.2. So unless the Google API client library is incompatible with a particular PHP version there shouldn’t be any issue. Please copy and paste the content from the “Server Info” tab so I can take a look.

      1. Here is the server info you requested. Thanks in advance!

        Gmail SMTP 1.1.5
        WordPress 4.8.1
        OS: Linux xxxxxxxxx 3.13.0-76-generic #120-Ubuntu SMP Mon Jan 18 15:58:41 UTC 2016 i686
        PHP version: 7.0.22-0ubuntu0.16.04.1
        WordPress version: 4.8.1
        WordPress multisite: No
        openssl: Available
        allow_url_fopen: Enabled
        stream_socket_client: Available
        fsockopen: Available
        cURL: Available
        cURL Version: 7.47.0, OpenSSL/1.0.2g

  23. I inserted a different email address in the “From Email Address” box on the plugin, but it is still emailing people with the gmail account email address. Please advise

  24. Please help me. I’m desperate.
    I’ve done the setup procedure more than 10 times, and everything works correctly for one day. Then it just stops working.
    Everything looks ok with the credentials on Google, and the plugin submission test does not return any errors in the debugger, but the message does not arrive either.
    I know that if you re-do the whole setup procedure will work again for some time, and then stop.
    What could be happening?

    Server Info:
    OS: Linux l70cnn0368 3.10.0-514.26.2.el7.x86_64 # 1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64
    PHP version: 7.0.22
    WordPress version: 4.8.2
    WordPress multisite: No
    openssl: Available
    allow_url_fopen: Enabled
    stream_socket_client: Available
    fsockopen: Available
    cURL: Available
    cURL Version: 7.29.0, NSS / 3.21 Basic ECC

  25. When someone leaves a comment under my blog posts, they get an error message (see below). The comment shows up for my approval and is visible at the end but the author of the comment doesn’t know that and they keep trying rewriting comments and every time they get that error message.

    Fatal error: Uncaught exception ‘LogicException’ with message ‘refresh token must be passed in or set as part of setAccessToken’ in /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php:267 Stack trace: #0 /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php(255): Google_Client->fetchAccessTokenWithRefreshToken(NULL) #1 /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(143): Google_Client->refreshToken(NULL) #2 /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php(470): GmailXOAuth2->getOauth64() #3 /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(153): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”, Object(GmailXOAuth2)) #4 /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1540): PHPMailerOAuth->smtpConnect(Array) #5 /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmail in /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php on line 267

    Possible solutions that I tried and that didn’t work:
    -downgrading the plugin to the 1.1.1 version
    -revoke and reauthenticate with 2 different credentials various times

    Test emails get error message too. I’d like to emphasize – both the emails and comments get through to me. While I don’t see problems with sending/receiving emails, my biggest concern is the comment section. I’ve reached out to my hosting provider and Jatpack support and they couldn’t solve this saying I should contact the developer of the plugin. Please advise!

  26. Thank you for the great plugin.

    I also received the “Invalid token format” like others did. I installed the “WP Rollback” plugin wordpress.org/plugins/wp-rollback/ and rolled the plugin back to version 1.1.2. Then I revoked access following the instrucitons in the “Revoke Access” tab of the plugin, then granted permission again. It finally worked. There seems to be an issue with the current version.

    Info from my “Server Info” tab is as follows:

    OS: Linux pod-101100 3.13.0-129-generic #178-Ubuntu SMP Fri Aug 11 12:48:20 UTC 2017 x86_64
    PHP version: 5.6.31-4+wpengine10
    WordPress version: 4.8
    WordPress multisite: No
    openssl: Available
    allow_url_fopen: Enabled
    stream_socket_client: Available
    fsockopen: Available
    cURL: Available
    cURL Version: 7.35.0, OpenSSL/1.0.1f

  27. Team,
    I’m trying to setup my WP site, to work with gmail plugin, but without luck. I can’t see any errors in the log:

    2017-09-26 20:40:02 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ( ‘ssl’ => array ( ‘verify_peer’ => false, ‘verify_peer_name’ => false, ‘allow_self_signed’ => true, ),)
    2017-09-26 20:40:02 Connection: opened
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “220 smtp.gmail.com ESMTP 92sm7056092wrq.83 – gsmtp”
    2017-09-26 20:40:02 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP 92sm7056092wrq.83 – gsmtp
    2017-09-26 20:40:02 CLIENT -> SERVER: EHLO vnext.pro
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-smtp.gmail.com at your service, [52.59.154.20]”
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-SIZE 35882577”
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-8BITMIME”
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-STARTTLS”
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-STARTTLS”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-ENHANCEDSTATUSCODES”
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-PIPELINING”
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-CHUNKING”
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250 SMTPUTF8”
    2017-09-26 20:40:02 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2017-09-26 20:40:02 CLIENT -> SERVER: STARTTLS
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “220 2.0.0 Ready to start TLS”
    2017-09-26 20:40:02 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
    2017-09-26 20:40:02 CLIENT -> SERVER: EHLO vnext.pro
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-smtp.gmail.com at your service, [52.59.154.20]”
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-SIZE 35882577”
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-8BITMIME”
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH”
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-ENHANCEDSTATUSCODES”
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-PIPELINING”
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-CHUNKING”
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250 SMTPUTF8”
    2017-09-26 20:40:02 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2017-09-26 20:40:02 Auth method requested: XOAUTH2
    2017-09-26 20:40:02 Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH
    2017-09-26 20:40:02 CLIENT -> SERVER: QUIT
    2017-09-26 20:40:02 SMTP -> get_lines(): $data is “”
    2017-09-26 20:40:02 SMTP -> get_lines(): $str is “221 2.0.0 closing connection 92sm7056092wrq.83 – gsmtp”
    2017-09-26 20:40:02 SERVER -> CLIENT: 221 2.0.0 closing connection 92sm7056092wrq.83 – gsmtp
    2017-09-26 20:40:02 Connection: closed

    ————————

    OS: Linux ip-172-31-33-48 3.13.0-119-generic #166-Ubuntu SMP Wed May 3 12:18:55 UTC 2017 x86_64
    PHP version: 7.0.18
    WordPress version: 4.8.2
    WordPress multisite: No
    openssl: Available
    allow_url_fopen: Enabled
    stream_socket_client: Available
    fsockopen: Available
    cURL: Available
    cURL Version: 7.45.0, OpenSSL/1.0.2l

    Would you please take a look?

    Regards,
    Niko

  28. Hi,
    I’m using the Better Notifications for WordPress plugin to send email to all 150 users whenever a new post “Announcement” post is published. I installed the Gmail SMTP plugin because users with AOL addresses (yes, people still have those) weren’t getting those notifications. Now when I publish a new announcement, about 50 emails go out before the server coughs up blood and times out.

    My site is running WordPress 4.8.2 on PHP 5.6. Any ideas?
    thanks,
    pq

  29. Hi there,

    I am receiving the following error do you know why?

    Great walk through thank you!

    Fatal error: Uncaught exception ‘InvalidArgumentException’ with message ‘Invalid token format’ in /var/sites/n/nelsonandpops.co.uk/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php:434 Stack trace: #0 /var/sites/n/nelsonandpops.co.uk/public_html/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(138): Google_Client->setAccessToken(‘{“error”:”inval…’) #1 /var/sites/n/nelsonandpops.co.uk/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php(470): GmailXOAuth2->getOauth64() #2 /var/sites/n/nelsonandpops.co.uk/public_html/wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(153): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”, Object(GmailXOAuth2)) #3 /var/sites/n/nelsonandpops.co.uk/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1540): PHPMailerOAuth->smtpConnect(Array) #4 /var/sites/n/nelsonandpops.co.uk/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1335): PHPMailer->smtpSend(‘Date: Fri, 29 S…’, ‘test\n’) #5 /va in /var/sites/n/nelsonandpops.co.uk/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php on line 434

    1. My server info is below:

      OS: Linux lin-10-170-0-70.gridhost.co.uk 3.2.83 #2 SMP Thu Oct 27 13:06:55 BST 2016 x86_64
      PHP version: 5.6.22
      WordPress version: 4.8.2
      WordPress multisite: No
      openssl: Available
      allow_url_fopen: Enabled
      stream_socket_client: Available
      fsockopen: Available
      cURL: Available
      cURL Version: 7.41.0, OpenSSL/1.0.2a

    2. Fatal error: Uncaught exception ‘InvalidArgumentException’ with message ‘Invalid token format’ in /home/httpd/vhosts/inoxmontagen.ch/mim-inox.com/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php:434 Stack trace: #0 /home/httpd/vhosts/inoxmontagen.ch/mim-inox.com/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(138): Google_Client->setAccessToken(‘{“error”:”inval…’) #1 /home/httpd/vhosts/inoxmontagen.ch/mim-inox.com/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php(470): GmailXOAuth2->getOauth64() #2 /home/httpd/vhosts/inoxmontagen.ch/mim-inox.com/wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(153): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”, Object(GmailXOAuth2)) #3 /home/httpd/vhosts/inoxmontagen.ch/mim-inox.com/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1540): PHPMailerOAuth->smtpConnect(Array) #4 /home/httpd/vhosts/inoxmontagen.ch/mim-inox.com/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1335): PHPMailer->smtpSend(‘Date: Mon, 2 Oc…’ in /home/httpd/vhosts/inoxmontagen.ch/mim-inox.com/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php on line 434

      -> Same error here, whats the solution for it?

  30. Good day,

    We use this plugin on our multisite.
    It is working just perfect on the sites. Recently we tried to add the SMPT to our new site that we are launching.

    And it is not working on the new site (all the old ones are working just perfect)
    Firstly, it was not sending any emails with the error
    Client -> SERVER: QUIT
    instead of quit it should load OAUTH2 and then send the emial.

    So i read the comments, i read the support and tried deleting the data in plugin and saving and deleting the project in developers console (fresh authorization) and reactivating the plugin.

    Since then i can not Grant access at all
    I get error :
    “401. That’s an error.

    Error: deleted_client

    The OAuth client was deleted.”

    Even though the client is not deleted. Tried it several times but cant seem to get past this anymore.
    Do you think google could stopped my developers account after trying so many times creating new Oauth2 acces ? The account did not notified me that it did that so i do not believe it…

    But anyway, anyone any suggestions or another plugin that might work?

    As well, could it be that we upgraded the plugin and the other sites were set up before the update?

    Kind regards,
    Kristof

  31. I am getting this: And have tried everything suggested above…. weh I test email this is what comes back.
    2017-10-02 16:24:59 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
    2017-10-02 16:25:01 Connection failed. Error #2: stream_socket_client(): unable to connect to smtp.gmail.com:587 (Connection refused) [/home/hairobse/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 294]
    2017-10-02 16:25:01 SMTP ERROR: Failed to connect to server: Connection refused (111)
    SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

  32. I am trying to put the Gmail SMTP Plugin in on a site and when I test the email it says:
    2017-10-02 16:24:59 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
    2017-10-02 16:25:01 Connection failed. Error #2: stream_socket_client(): unable to connect to smtp.gmail.com:587 (Connection refused) [/home/hairobse/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 294]
    2017-10-02 16:25:01 SMTP ERROR: Failed to connect to server: Connection refused (111)
    SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    IT says that is connected and got notice on the gmail account but when I test it see above

    1. @michael, Usually this error occurs when the port in question is blocked on the server. Who is your hosting provider? You need to contact them to make sure that port 587 is open and supports TLS encryption. Have you tried SSL on port 465 or 443?

        1. @Chloe, It seems to be an intermittent issue that’s affecting a few sites. I have tested the plugin on different servers running on different PHP versions. But I have not been able to reproduce it. It may have something to do with the Google API Client library that was updated recently. Can you please install version 1.1.2 and see how it goes?

          https://wordpress.org/plugins/gmail-smtp/advanced/

          1. @Chloe Yes I tried all the suggested settings and ports, I can try again-didn’t do the one you suggested, but will and let you know. Godaddy is the host.

  33. Tried that the STMP mailer ;
    Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array ()
    Connection: Failed to connect to server. Error number 2. “Error notice: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused)
    SMTP ERROR: Failed to connect to server: Connection refused (111)
    SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    Talked to GOdaddy and they said they don’t have ports blocked, but also said have to have a private dedicated server to manipulate ports. THis is a new client, just noticed that they do not have SSL certificate, is that m must to do any of this?

  34. i have this error during testing. please how can i fix it
    2017-10-07 00:51:19 Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array ()
    2017-10-07 00:51:21 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Network is unreachable) [/home/gchabmyy/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 294]
    2017-10-07 00:51:21 SMTP ERROR: Failed to connect to server: Network is unreachable (101)
    SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    1. @Harvey, Usually this error occurs when the port in question is blocked on the server. Who is your hosting provider? You need to contact them to make sure that port 465 is open and supports SSL encryption. Have you tried TLS on port 587 or SSL on port 443?

  35. Hi,
    My hosting provider says port 587 TLS is open by default!!!?
    I tried all the possibility options (with or without this: Disable SSL Certificate Verification) Also tried with port 26 but still doesn’t work!
    Below are Errors for ports 465 SSL and 587 TLS. Any other suggestion on using Google SMTP with API?

    Thanks
    Nik
    ————————————————————————–
    OS: Linux box354.bluehost.com 3.10.0-614.10.2.lve1.4.50.el6h.x86_64 #1 SMP Mon May 22 17:31:11 EDT 2017 x86_64
    PHP version: 7.0.12
    WordPress version: 4.8.2
    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
    ————————————————————————–
    2017-10-08 19:07:27 Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array ()
    2017-10-08 19:11:41 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Network is unreachable) [/*****/*****/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 292]
    2017-10-08 19:11:41 SMTP ERROR: Failed to connect to server: Network is unreachable (101)
    SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
    ————————————————————————–
    2017-10-08 19:01:27 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
    2017-10-08 19:05:41 Connection failed. Error #2: stream_socket_client(): unable to connect to smtp.gmail.com:587 (Network is unreachable) [/*******/********/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 292]
    2017-10-08 19:05:41 SMTP ERROR: Failed to connect to server: Network is unreachable (101)
    SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
    ————————————————————————-

    1. I just got confirmation from Bluehost themselves that they do not support smtp.gmail.com. They want you to use their smtp server.

      1. Nope, I couldn’t make it work!
        If their SMTP Servers are in blacklist with a very bad reputation for sending e-mails then they should allow their clients to use different options!

        Anyway, they also have some different good SMTP and I think that’s what I am using at the moment to send e-mails to inbox!

  36. Hi All,

    Everything is working brilliantly for me, apart from the password reset function now not working for me.

    If I try to use the wordpress password reset function I get the following error message:

    The email could not be sent.
    Possible reason: your host may have disabled the mail() function.

    Do you know how to fix this?

    Thanks a lot!

    Dave

  37. Plugin is conflicting with Caldera Forms (Caldera Labs) and/or WP E-Signature (Approve Me).

    When I send a test email, it sits for a long time, then times out with an error of “Page unavailable at this time”
    When I try to submit a form, the spinner just sits there and never passes the form information to the E-Signature platform.
    When I remove the plug-in.

  38. host says “use port 587 TLS” but I get this error when sending the test email.

    2017-10-13 20:47:18 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
    2017-10-13 20:47:21 Connection failed. Error #2: stream_socket_client(): unable to connect to smtp.gmail.com:587 (Connection refused) [/home/xxx/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 293]
    2017-10-13 20:47:21 SMTP ERROR: Failed to connect to server: Connection refused (111)

    thanks

  39. I was using 1.1.5. I was unable to send emails. The error is below. I tried to refresh the authorization, however when trying to grant access I received a 500 error on the redirect back after accepting.

    I went back to 1.1.2 and it resolved the issue.
    Cheers
    2017-10-17 10:47:21 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [an IP here]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2017-10-17 10:47:21 Auth method requested: XOAUTH2
    2017-10-17 10:47:21 Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH
    2017-10-17 10:47:21 CLIENT -> SERVER: QUIT
    2017-10-17 10:47:21 SMTP -> get_lines(): $data is “”
    2017-10-17 10:47:21 SMTP -> get_lines(): $str is “”
    2017-10-17 10:47:21 SERVER -> CLIENT:
    2017-10-17 10:47:21 SMTP ERROR: QUIT command failed:
    2017-10-17 10:47:21 Connection: closed

  40. I installed this to use with Contact Form 7. I am able to send and receive a test email using the plugin test panel. However, when I fill out the contact 7 form – I do not receive the message – despite Contact form 7 saying the message had been sent successfully. Am I missing a setting?

Leave a Reply

Your email address will not be published. Required fields are marked *