Gmail SMTP Plugin for WordPress

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 wordpress plugin

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.

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 naa986”
  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

Gmail SMTP Project Creation

1. Go to console.cloud.google.com/apis/dashboard.

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.

Credentials/App Creation

1. Once the project is created go to Credentials > CREATE CREDENTIALS and select OAuth client ID.

2. In order to create an OAuth client ID, you need to configure the OAuth consent screen first. So click CONFIGURE CONSENT SCREEN.

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

3. Choose how you want to configure and register your app. Since I’m not using G Suite I had to choose External.

screenshot showing how to choose a user type in the oauth consent screen of the google developers console

4. Enter a name (e.g. Gmail SMTP) for the OAuth consent screen.

screenshot showing the OAuth consent screen 2 in the google developers console

5. You can configure optional fields such as Authorized domains, Application home page, Application privacy policy link and Application terms of service link (I was able to skip all and click SAVE AND CONTINUE). You do however need to enter an email address under the Developer contact information section.

screenshot showing part 2 of the consent screen 2 in the google developers console

6. Skip the Scopes screen.

screenshot showing the Scopes tab in the OAuth consent screen of the Google cloud console

7. Add a test user if you plan to use this app in test mode (This is not required if you want to publish it).

screenshot showing the Test users tab in the OAuth consent screen of the Google cloud console

8. Keep your app in test mode or publish it. If the Publishing status is set to In production, a warning message (This app isn’t verified) may appear on the consent screen that you can easily skip.

screenshot showing the Summary tab in the OAuth consent screen of the Google cloud console

Now that the OAuth consent screen has been configured you can create an OAuth Client ID.

9. Go to the Credentials tab and select OAuth client ID under CREATE CREDENTIALS.

screenshot showing how to select OAuth client Id under CREATE CREDENTIALS in the google developers console

10. Set the application type to Web application and enter a name for it (e.g. Gmail SMTP App). 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

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

Gmail SMTP Settings Configuration

1. 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.

2. 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

3. 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

4. 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.

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 that the plugin received when you first granted your app access to the Gmail API. This token is necessary 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 you delete this token 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.

Gmail SMTP Add-ons

Gmail SMTP plugin comes with add-ons that you can use to enhance its functionality on your website.

Reply-To

Reply-To add-on lets you set a reply-to address for all outgoing email messages.

Cc

Cc add-on lets you set a cc recipient for all outgoing email messages.

712 thoughts on “Gmail SMTP Plugin for WordPress”

  1. I am unable to send an email from the ‘test email’ screen.help me
    getting this error

    Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
    Connection: opened
    SMTP -> get_lines(): $data is “”
    SMTP -> get_lines(): $str is “421 Cannot connect to SMTP server 2404:6800:4003:c00::6d (2404:6800:4003:c00::6d:587), connect error 10060”
    SERVER -> CLIENT: 421 Cannot connect to SMTP server 2404:6800:4003:c00::6d (2404:6800:4003:c00::6d:587), connect error 10060
    CLIENT -> SERVER: EHLO localhost
    SMTP -> get_lines(): $data is “”
    SMTP -> get_lines(): $str is “”
    SERVER -> CLIENT:
    SMTP ERROR: EHLO command failed:
    SMTP NOTICE: EOF caught while checking if connected
    Connection: closed
    SMTP Error: Could not connect to SMTP host.
    SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    Reply
    • i have same problem as yours.
      anyone can help??

      Reply
    • I also had the problem. My issue was that my redirect-uri was not set and saved properly in the google credentials for the App. The correct redirect-uri is provided in the top field of your GMAIL SMTP plugin configuration page, so copy that, then paste it into the redirect-uri credentials box for your app and save – THEN, and I missed this – you need to Save AGAIN to make sure your entire credentials are saved.

      So that’s what worked for me.

      Reply
  2. 400. That’s an error.

    Error: redirect_uri_mismatch

    The redirect URI in the request, utahcprtraining.com/wp-admin/options-general.php?page=gmail-smtp-settings&action=oauth_grant, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: console.developers.google.com/apis/credentials/oauthclient/476210630762-vunvrjtnnt900p6cescun8gs4mupjfpq.apps.googleusercontent.com?project=476210630762

    Learn more

    Reply
    • @Jake, Please check the troubleshooting section.

      Reply
      • same error with me . where to find trouble shooting section

        Reply
        • where troubleshooting section?
          @admin please answer the question!!!

          Reply
    • You must authorize the url on the Google Developers Console, as described at step 6 of tutorial. Paste the first url displayed on error message and add it.

      Reply
      • I’m having the very same problem and I’ve tried and retried to do the instructions in step 6 about authorizing the url on the google developers console, I pasted the url the and checked again, then I clicked on done. It showed the message saying the url was well authorized and redirected me to the previous page (it happened all the time when I tried again and again). But I noticed that when I was coming back to tha page to past the OAuth url, the same url I pasted earlier had dissapeared, it couldn’t be found mensionned there at all, as if when I clicked on “done” button the previous time, it did not registered it at all…
        So I’m still stuck at that point till now. Can anyone help please?

        Reply
  3. I got it install and works, but how do I use it on a page? do you have an examle?

    Reply
    • @Robert, There is nothing to set up on a page. Once you configure the SMTP related settings, your email will be sent via SMTP when the wp_mail function is called.

      Reply
  4. Hi,

    The docs seem way out-of-date and the screenshots don’t reflect what they look like when I use the console.developers.google.com link. There are functional similarities and the process appears analagous to what the docs describe, but there are significant differences. For example, I didn’t see any mention of, or provision of a value for, the Client Secret when the Client ID was created.

    Thanks and All the Best,
    Jim

    Reply
  5. Connection failed. Error #2: stream_socket_enable_crypto(): Peer certificate CN=`*.bluehost.com’ did not match expected CN=`smtp.gmail.com’

    Tried everyhing in troubleshooting it was working.

    Reply
    • Sent about 50 emails now just get an error-even tried revoking and adding- Plugin all green but no longer works.

      Reply
  6. Hello,

    We are having a problem all of the sudden with this plug-in on our WP installation within Azure. We are getting the following message now whenever we try a test message, and no emails are going out from the site any more:

    Connection failed. Error #2: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

    This was working fine a couple of months ago. Plugin v1.1.17, PHP v7.0, WP v4.9.4

    Please help

    Reply
    • @Robert, Please check the troubleshooting section.

      Reply
      • I have. I have tried this on all suggested ports (587, 465, 25) for both TSL and SSL. Also, you may notice that I am getting the error message “Error #2”, yet the message is not a scope one but rather an inability to validate a certificate which doesn’t match what is listed as Error #2 in the troubleshooting section. Again, this was working previously without any issues and then stopped.

        Reply
  7. Hello, on the google developer website it does not let me include the redirect url because it says the following:

    To be used with the requests of a web server. It is the path of the application that is redirected to users after authenticating on Google. The access authorization code will be added to this route. It must have a protocol. It can not include URL fragments or relative paths. It can not be a public IP address.

    By including this url it does not leave me because it has fragments:

    https://example.com/wp-admin/options-general.php?page=gmail-smtp-settings&action=oauth_grant

    and I get this error by pressing the “Grant Permission” button

    400. That’s an error.

    Error: redirect_uri_mismatch

    The redirect URI in the request, https://cursoseowp.com/wp-admin/options-general.php?page=gmail-smtp-settings&action=oauth_grant, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/oauthclient/741426008276-2sftf3lfr3e1m8vtde9l0dmtmfo14joa.apps.goog

    Any suggestions?

    Reply
  8. Hello. I see the advice for GoDaddy, to change the server to relay-hosting.secureserver.net. I am not sure where to do this. Please advise.

    Reply
  9. I have this error:

    2018-02-21 08:14:54 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
    2018-02-21 08:14:56 Connection failed. Error #2: stream_socket_client(): unable to connect to smtp.gmail.com:587 (Connection refused) [/home/yxabyaj870g6/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 293]
    2018-02-21 08:14:56 SMTP ERROR: Failed to connect to server: Connection refused (111)
    SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    Reply
    • @Michael, Please check the troubleshooting section.

      Reply
  10. Hello,
    Thank you for the module and the support!

    I have installed with no problems (great documentation), but the emails I receive are coming from wordpress@my-domain.com instead from my Gmail address.

    I am struggling to find where to this setting.

    Could you please help?

    Thank you,
    Michal

    Reply
  11. Hello, I have problem with allow gmail smtp because after press the allow button I will get “HTTP ERROR 500”. Step by step: Grant premission – Log into gmail account – Application requests access to my Google Account – Press allow button and then comes error 500. So I can not to add application to my gmail account. Can you help me what can I do?

    Reply
    • is this solved ZSolt? I am also facing same issue

      Reply
  12. Can someone help me with this error????

    2018-05-03 15:26:04 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
    2018-05-03 15:26:04 Connection: opened
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “220 smtp.gmail.com ESMTP r90sm25504585pfg.122 – gsmtp”
    2018-05-03 15:26:04 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP r90sm25504585pfg.122 – gsmtp
    2018-05-03 15:26:04 CLIENT -> SERVER: EHLO digitechoffice.net
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250-smtp.gmail.com at your service, [192.232.225.44]”
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [192.232.225.44]”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250-SIZE 35882577”
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [192.232.225.44]250-SIZE 35882577”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250-8BITMIME”
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [192.232.225.44]250-SIZE 35882577250-8BITMIME”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250-STARTTLS”
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [192.232.225.44]250-SIZE 35882577250-8BITMIME250-STARTTLS”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250-ENHANCEDSTATUSCODES”
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [192.232.225.44]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250-PIPELINING”
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [192.232.225.44]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250-CHUNKING”
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [192.232.225.44]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250 SMTPUTF8”
    2018-05-03 15:26:04 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [192.232.225.44]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2018-05-03 15:26:04 CLIENT -> SERVER: STARTTLS
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “220 2.0.0 Ready to start TLS”
    2018-05-03 15:26:04 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
    2018-05-03 15:26:04 CLIENT -> SERVER: EHLO digitechoffice.net
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250-smtp.gmail.com at your service, [192.232.225.44]”
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [192.232.225.44]”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250-SIZE 35882577”
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [192.232.225.44]250-SIZE 35882577”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250-8BITMIME”
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [192.232.225.44]250-SIZE 35882577250-8BITMIME”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH”
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [192.232.225.44]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250-ENHANCEDSTATUSCODES”
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [192.232.225.44]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250-PIPELINING”
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [192.232.225.44]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250-CHUNKING”
    2018-05-03 15:26:04 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [192.232.225.44]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING”
    2018-05-03 15:26:04 SMTP -> get_lines(): $str is “250 SMTPUTF8”
    2018-05-03 15:26:04 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [192.232.225.44]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2018-05-03 15:26:04 Auth method requested: XOAUTH2
    2018-05-03 15:26:04 Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH
    2018-05-03 15:26:05 CLIENT -> SERVER: AUTH XOAUTH2 dXNlcj1lcmljay50cmFoYW5AZGlnaXRhbHByb2R1Y3Qtc29sdXRpb25zLmNvbQFhdXRoPUJlYXJlciB5YTI5LkdsdXdCVDVIT3g2d2dZbnNPYTJtbXpsVTRsNkpKT3Z5SzNOdnItSlZWNXlkaUE1a01obHNxVTBWV2R4aXVkVjVTTW5Pa3g2VW0zYndtRDNiYmk1SktmY2JIUlk2TEo5ZzBCZVJjVnh5bTVyRUZ1Z3pkLWhyMS05dHRXMHkBAQ==
    2018-05-03 15:26:05 SMTP -> get_lines(): $data is “”
    2018-05-03 15:26:05 SMTP -> get_lines(): $str is “334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==”
    2018-05-03 15:26:05 SERVER -> CLIENT: 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
    2018-05-03 15:26:05 SMTP ERROR: AUTH command failed: 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
    SMTP Error: Could not authenticate.
    2018-05-03 15:26:05 CLIENT -> SERVER: QUIT
    2018-05-03 15:26:05 SMTP -> get_lines(): $data is “”
    2018-05-03 15:26:05 SMTP -> get_lines(): $str is “535-5.7.8 Username and Password not accepted. Learn more at”
    2018-05-03 15:26:05 SMTP -> get_lines(): $data is “535-5.7.8 Username and Password not accepted. Learn more at”
    2018-05-03 15:26:05 SMTP -> get_lines(): $str is “535 5.7.8 https://support.google.com/mail/?p=BadCredentials r90sm25504585pfg.122 – gsmtp”
    2018-05-03 15:26:05 SERVER -> CLIENT: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8 https://support.google.com/mail/?p=BadCredentials r90sm25504585pfg.122 – gsmtp
    2018-05-03 15:26:05 SMTP ERROR: QUIT command failed: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8 https://support.google.com/mail/?p=BadCredentials r90sm25504585pfg.122 – gsmtp
    2018-05-03 15:26:05 Connection: closed
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    Reply
  13. Where is this located: “This means you will need to reauthorize (using the web application link in the settings) before you can start using the plugin again.”

    Reply
  14. What needs to be done so I don’t have to keep refreshing the token manually? We use this for 40+ websites and it is a pain to keep up with.

    Reply
  15. I’ve been trying for weeks to make this plugin work. It seems to validate itself okay when setup with a G Suite account but the Test phase always involves a set of returned errors looking like this:

    ——————————-

    2018-06-10 14:53:13 Connection: opening to ssl://smtp.nukewar.info:25, timeout=300, options=array ( ‘ssl’ => array ( ‘verify_peer’ => false, ‘verify_peer_name’ => false, ‘allow_self_signed’ => true, ),)
    2018-06-10 14:55:20 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.nukewar.info:25 (Connection timed out) [/home/u975515988/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 298]
    2018-06-10 14:55:20 SMTP ERROR: Failed to connect to server: Connection timed out (110)
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    ————————

    It returns this error whether or not security is set to TLS or SSL and regardless of which port I use, so it’s weird that it ALWAYS says “opening to ssl://smtp.nukewar.info:25” regardless of what options are set.

    Google Support says my DNS is setup just fine for the MX records it needs.

    My hosting provider tells me there’s no place to do this (from G Suite’s setup instructions): “Configure your on-premise outbound email server to point to smtp-relay.gmail.com.”

    So that must mean the problem lies in the plugin somewhere. This line seems like it’s pointing to the origin of the error: /home/u975515988/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 298

    Where apparently PHPMailer is a helper app embedded in the Gmail SMTP plugin, which logically would be set up by the Gmail SMTP plugin but nothing has to be logical with WordPress plugins, so I’m thinking the PHPMailer needs to be hard coded to achieve what Google says: “Configure your on-premise outbound email server to point to smtp-relay.gmail.com.”

    Trouble is, how to do that is not described anywhere in the Gmail SMTP instructions, and my attempts to insert ‘smtp-relay.gmail.com’ into the logical places in class.smtp.php do nothing, and unfortunately I’m not a PHP programmer capable of tracking back to all the potential secret places which might be where ‘smtp-relay.gmail.com’ actually belongs.

    So now I’m wondering if this is even a functioning plugin that anyone has ever gotten to work, or is it some vestigial crap that I made a big mistake with. I’ll give this post a day or two to get answered or not before I give up on this plugin and just use another one.

    Reply
  16. PS: The suggested help at https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting that appears in the error output is pretty useless, and apparently assumes that you already know almost everything you need to know to fix problems. Almost but not quite, like what files to put the code snippets in. And they want you to go chasing down another rabbit hole with something called ‘composer’. This ‘help’ might be fine for an experienced PHP programmer but looks like weeks or months, even possibly years of study for someone who just wants to make a frigging WP plugin work. Did the developer of Gmail SMTP just leave it open-ended so that everybody has to fix the PHPMailer before anything will work? And then not tell us?

    Reply
      • UPDATE: After consulting with Google Support and making some changes on their end, the test email error messages have gone away which looks like all is good, BUT the emails never get delivered!

        So is this plugin not able to use smtp.gmail.com, or what?

        How do other people make it work?

        Is this really an issue with the PHPMailer, or is there some special setup for that I don’t know about?

        I would like to use this plugin if possible.

        Reply
  17. Thanks so much for this 🙂

    Reply
  18. Hello, what happen if the system needs to send 10.000 in a time?
    Regards

    Reply
  19. Hello,
    I have managed to setup Gmail SMTP.

    with following example:
    OAuth Email Address: abc@gmail.com
    From Email Address: zyx@gmail.com (I presume this should be the email address that the recipient should see on incoming email) but test mail I sent shows abc@gmail.com which is OAuth Email Address and it’s different from email address.

    Please guide me what I maybe doing wrong or needs change.

    Reply
    • @RS, Gmail doesn’t allow you to change the from email address for security reasons.

      Reply
  20. I have the settings correct and the app is authorized. When sending a test email, I get returned to a screen with: 405 Not Allowed
    nginx/1.14.0

    Do you know what the problem is?

    Reply

Leave a Comment