• Skip to main content
  • Skip to primary sidebar

WordPress HowTo

WPHowto is the place to download free WordPress plugins and free WordPress themes. WPHowto focuses on free how-to tutorials for WordPress, popular WordPress plugin/theme reviews, best cheap WordPress hosting reviews and tutorials on WooCommerce.

  • Home
  • Plugins
    • Themes
  • Hosting
  • Contact
    • Privacy Policy
  • About

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 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. A self-hosted WordPress site running on a WordPress Optimized Environment.
  2. PHP 5.6 or later.
  3. A Gmail Account.
  4. Port 587 needs to be open and support TLS encryption. If that’s not possible port 465 needs to be open and support SSL encryption.
  5. Your Web host needs to allow communication with an external SMTP server.

Gmail SMTP Info

Plugin Name: Gmail SMTP
Version: 1.2.0
File Format: application/zip
Requires: WordPress 5.6
Rating: 4.0 based on 93 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

Gmail SMTP Project Creation

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 ENABLE APIS AND SERVICES.

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.

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

Credentials/App Creation

1. Now that you have enabled this API you need credentials to use it. So click CREATE CREDENTIALS.

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

2. This takes you to an interface where you can find out the kind of credentials you need. You can skip it by clicking on the client ID link.

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

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

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

screenshot showing the oauth consent screen in the google developers console

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

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

6. You can configure optional fields such as Authorized domains, Application Homepage link, Application Privacy Policy link and Application Terms of Service link. I was able to skip all and click Save.

screenshot showing part 2 of the consent screen 2 in the google developers console
confirmation shown after the Oauth consent screen is configured in the google developers console

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

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

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

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

Authorization Error

screenshot showing error 403 access denied error when trying to authorize an app in google developer console

If you click the Grant Permission button and get an authorization error (Error 403: access denied) please follow these steps:

  1. Go to Oauth consent screen of your app.
  2. Click Add user under Test users.
  3. Add the email address corresponding to your google account.

This app isn’t verified

screenshot of the this app isn't verified error when authorizing a google app

If you get the This app isn’t verified error simply click Advanced and continue.

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.

Error #1

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

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

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

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.

Error #5

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.

Error #6

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

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

Disclosure: This page may contain affiliate links. If you follow one of those affiliate links and purchase something it will provide me with a little bit of a commission. This costs you nothing extra but helps maintain my site, free plugins, and themes. So I thank you for your support.

Share this:

  • Twitter
  • Facebook
  • Pinterest

Related

Written by Noor Alam · Categorized: plugin, wordpress

Reader Interactions

Comments

  1. Pete Harrison says

    I get the following error when Granting permission to use Gmail

    Fatal error: Uncaught GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in C:\inetpub\wwwroot\Cypriotsworldwide.com\wp-content\plugins\gmail-smtp\google-api-php-client\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:187 Stack trace: #0 C:\inetpub\wwwroot\Cypriotsworldwide.com\wp-content\plugins\gmail-smtp\google-api-php-client\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array) #1 C:\inetpub\wwwroot\Cypriotsworldwide.com\wp-content\plugins\gmail-smtp\google-api-php-client\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(103): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #2 C:\inetpub\wwwroot\Cypriotsworldwide.com\wp-content\plugins\gmail-smtp\google-api-php-client\vendor\guzzl in C:\inetpub\wwwroot\Cypriotsworldwide.com\wp-content\plugins\gmail-smtp\google-api-php-client\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 187

    Fatal error: Cannot declare class phpmailerException, because the name is already in use in C:\inetpub\wwwroot\Cypriotsworldwide.com\wp-includes\class-phpmailer.php on line 4040

    Reply
  2. Andrew says

    Hi I have had the following de-bug issue come up. Is the best solution to re-install the plugin?

    Uncaught Exception: Invalid token format in /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php on line 434
    setAccessToken()
    wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php:145
    getOauth64()
    wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php:475
    authenticate()
    wp-content/plugins/gmail-smtp/class.phpmaileroauth.php:152
    smtpConnect()
    wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php:1542
    smtpSend()
    wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php:1337
    postSend()
    wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php:1215
    send()
    wp-content/plugins/gmail-smtp/main.php:943
    wp_mail()
    wp-content/plugins/gmail-smtp/main.php:183
    test_email_settings()
    wp-content/plugins/gmail-smtp/main.php:120
    options_page()
    wp-includes/class-wp-hook.php:286
    apply_filters()
    wp-includes/class-wp-hook.php:310
    do_action()
    wp-includes/plugin.php:465
    do_action()
    wp-admin/admin.php:253
    require_once()
    wp-admin/options-general.php:10

    Reply
  3. Quy says

    Is the plugin still working w/t WP newest version?
    When I upgraded to version 5.2.4, it stopped sending email.
    It displays “The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.”
    at the end of the test message box.
    “2019-11-08 08:26:14 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
    2019-11-08 08:26:14 Connection: opened
    2019-11-08 08:26:14 SMTP -> get_lines(): $data is “”
    2019-11-08 08:26:14 SMTP -> get_lines(): $str is “220 smtp.gmail.com ESMTP c12sm6529663pfp.67 – gsmtp”
    2019-11-08 08:26:14 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP c12sm6529663pfp.67 – gsmtp
    2019-11-08 08:26:14 CLIENT -> SERVER: EHLO chothuephonghoithao.vn
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]”
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250-SIZE 35882577”
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]250-SIZE 35882577”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250-8BITMIME”
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]250-SIZE 35882577250-8BITMIME”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250-STARTTLS”
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]250-SIZE 35882577250-8BITMIME250-STARTTLS”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250-ENHANCEDSTATUSCODES”
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250-PIPELINING”
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250-CHUNKING”
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250 SMTPUTF8”
    2019-11-08 08:26:15 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2019-11-08 08:26:15 CLIENT -> SERVER: STARTTLS
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “220 2.0.0 Ready to start TLS”
    2019-11-08 08:26:15 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
    2019-11-08 08:26:15 CLIENT -> SERVER: EHLO chothuephonghoithao.vn
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]”
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250-SIZE 35882577”
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]250-SIZE 35882577”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250-8BITMIME”
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]250-SIZE 35882577250-8BITMIME”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH”
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250-ENHANCEDSTATUSCODES”
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250-PIPELINING”
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250-CHUNKING”
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “250 SMTPUTF8”
    2019-11-08 08:26:15 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2400:8901::f03c:91ff:fe1f:986f]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2019-11-08 08:26:15 Auth method requested: XOAUTH2
    2019-11-08 08:26:15 Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH
    2019-11-08 08:26:15 CLIENT -> SERVER: QUIT
    2019-11-08 08:26:15 SMTP -> get_lines(): $data is “”
    2019-11-08 08:26:15 SMTP -> get_lines(): $str is “221 2.0.0 closing connection c12sm6529663pfp.67 – gsmtp”
    2019-11-08 08:26:15 SERVER -> CLIENT: 221 2.0.0 closing connection c12sm6529663pfp.67 – gsmtp
    2019-11-08 08:26:15 Connection: closed

    The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.”
    It’s not just my website, I tested on many other of my websites and had same issues.
    Thank you

    Reply
    • Ismael says

      I received the following error.

      2019-11-14 22:30:44 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ( ‘ssl’ => array ( ‘verify_peer’ => false, ‘verify_peer_name’ => false, ‘allow_self_signed’ => true, ),)
      2019-11-14 22:30:45 Connection failed. Error #2: stream_socket_client(): unable to connect to smtp.gmail.com:587 (Connection refused) [/home/adminerp/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 298]
      2019-11-14 22:30:45 SMTP ERROR: Failed to connect to server: Connection refused (111)
      SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

      please, I need your help, thanks a lot.

      Regards
      Ismael

      Reply
      • Noor Alam says

        @Ismael, The log shows that the plugin is not being able to connect to the remote SMTP server. Please contact your host to make sure that port 587 is open and supports TLS encryption.

        Reply
        • Quoc Anh says

          @Noor Alam, I have same issue. I check my gmail and I enable IMAP on email, it work well someday ago. Today it stop work and i test send email and see the error message.

          Reply
  4. Tony says

    I am seeing authorisation failures. I have checked the client ID and secret are correct – even reset it – and the Google email address from the console is correct. It has previously been working. Any ideas?

    2019-11-15 12:51:50 Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH
    2019-11-15 12:51:51 CLIENT -> SERVER: AUTH XOAUTH2 dXNlcj1hZG1pbkBjZWx0aWMtY29tbWVyY2UuY29tAWF1dGg9QmVhcmVyIAEB
    2019-11-15 12:51:52 SMTP -> get_lines(): $data is “”
    2019-11-15 12:51:52 SMTP -> get_lines(): $str is “334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==”
    2019-11-15 12:51:52 SERVER -> CLIENT: 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
    2019-11-15 12:51:52 SMTP ERROR: AUTH command failed: 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
    SMTP Error: Could not authenticate.
    2019-11-15 12:51:52 CLIENT -> SERVER: QUIT
    2019-11-15 12:51:52 SMTP -> get_lines(): $data is “”
    2019-11-15 12:51:52 SMTP -> get_lines(): $str is “535-5.7.8 Username and Password not accepted. Learn more at”
    2019-11-15 12:51:52 SMTP -> get_lines(): $data is “535-5.7.8 Username and Password not accepted. Learn more at”
    2019-11-15 12:51:52 SMTP -> get_lines(): $str is “535 5.7.8 support.google.com/mail/?p=BadCredentials e16sm297716wrj.80 – gsmtp”
    2019-11-15 12:51:52 SERVER -> CLIENT: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8 support.google.com/mail/?p=BadCredentials e16sm297716wrj.80 – gsmtp
    2019-11-15 12:51:52 SMTP ERROR: QUIT command failed: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8 support.google.com/mail/?p=BadCredentials e16sm297716wrj.80 – gsmtp
    2019-11-15 12:51:52 Connection: closed
    SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    Reply
    • Noor Alam says

      @Tony, Have you changed your password recently? Although the plugin doesn’t use your username or password for authentication, it seems to cause an issue on Gmail’s end.

      Reply
      • tony says

        You are referring to the password for the gmail console account? No. It’s been the same for six months.

        Reply
        • Noor Alam says

          @tony, Have you tried a fresh authorization? If not please check this section “Fresh Authorization / Removing Access From the Application” for details.

          Reply
          • Jacob says

            Hi I am having the same issue, where can i find ths section “Fresh Authorization / Removing Access From the Application” To continue with the steps?
            Thank you

          • Jacob says

            Ok I got itm thank you!

    • Zihen says

      Hi, I have gotten the same problem with my sub domain website. The top domain website works well.

      SMTP Error: Could not authenticate.
      2020-03-15 13:32:24 CLIENT -> SERVER: QUIT
      2020-03-15 13:32:24 SMTP -> get_lines(): $data is “”
      2020-03-15 13:32:24 SMTP -> get_lines(): $str is “535-5.7.8 Username and Password not accepted. Learn more at”
      2020-03-15 13:32:24 SMTP -> get_lines(): $data is “535-5.7.8 Username and Password not accepted. Learn more at”
      2020-03-15 13:32:24 SMTP -> get_lines(): $str is “535 5.7.8 https://support.google.com/mail/?p=BadCredentials e28sm62371377pgn.21 – gsmtp”
      2020-03-15 13:32:24 SERVER -> CLIENT: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8 https://support.google.com/mail/?p=BadCredentials e28sm62371377pgn.21 – gsmtp
      2020-03-15 13:32:24 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 e28sm62371377pgn.21 – gsmtp
      2020-03-15 13:32:24 Connection: closed
      SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

      Thanks!

      Reply
  5. Tony says

    That got it, thanks!

    Reply
  6. pf loi says

    Hello,

    Everything seems going well at first sight but… when I try to send the test eMail, nothing happened, I didn’t get any eMail, I tried SSL/TLS, ports, adding eMail on “From Email Address” field or remove it, and various settings and test eMail addresses.

    I get no error message anywhere (including gmail console) but when subscribing a test form, then I get a “server error : form not sent”

    Do you have an idea of what could be wrong ?

    Regards

    Reply
  7. steven says

    I received the following error.

    Fatal error: Uncaught Error: Call to undefined method Google_Client::getRefreshToken() in /var/www/vhosts/giaiphapit.com.vn/httpdocs/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php:150 Stack trace: #0 /var/www/vhosts/giaiphapit.com.vn/httpdocs/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php(475): GmailXOAuth2->getOauth64() #1 /var/www/vhosts/giaiphapit.com.vn/httpdocs/wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(152): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”, Object(GmailXOAuth2)) #2 /var/www/vhosts/giaiphapit.com.vn/httpdocs/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1542): PHPMailerOAuth->smtpConnect(Array) #3 /var/www/vhosts/giaiphapit.com.vn/httpdocs/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1337): PHPMailer->smtpSend(‘Date: Thu, 19 D…’, ‘Gmail SMTP v1.1…’) #4 /var/www/vhosts/giaiphapit.com.vn/httpdocs/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1215): PHPMailer->postSend() #5 /var/www/vhosts/giaiphapit.com.vn/httpdocs/wp-content/ in /var/www/vhosts/giaiphapit.com.vn/httpdocs/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php on line 150

    please, I need your help, thanks a lot.

    Regards,
    Steven

    Reply
    • Noor Alam says

      @steven, Please check the instructions in the fresh authorization section and see how it goes.

      Reply
  8. NRF Australia says

    I am getting this error message:

    Invalid address: (setFrom) [my email address]
    Invalid address: (addAnAddress to): [to email address]

    This is the server info:
    OS: Linux s341.syd1.hostingplatform.net.au 3.10.0-962.3.2.lve1.5.24.6.el7.x86_64 #1 SMP Tue Dec 4 03:50:32 EST 2018 x86_64
    PHP version: 7.4.0
    WordPress version: 5.3.2
    WordPress multisite: No
    openssl: Available
    allow_url_fopen: Enabled
    stream_socket_client: Available
    fsockopen: Available
    cURL: Available
    cURL Version: 7.62.0, OpenSSL/1.0.2k

    Reply
    • Noor Alam says

      @NRF, When do you see this error? Can you please provide the full log?

      Reply
  9. Alan Snowden says

    We get a similar error when sending the Test Email

    Invalid address: (setFrom) [from address]
    Invalid address: (addAnAddress to): [recipient address]

    But both addresses used are valid and work in other applications

    Reply
    • Alan Snowden says

      Can anyone advise what causes this error and how to fix please?

      Invalid address: (setFrom) kerry@orlandobaggagestorage.com
      Invalid address: (addAnAddress to): help@ozewebhelp.com.au

      Reply
  10. Mohammed Hanif says

    Hello

    I have successfully installed this plugin, but it display an error (Gmail SMTP plugin cannot send email until you enter your credentials in the settings and grant access to your web application.) How to fix this let me know.

    Thanks

    Reply
    • Gaby Polanco says

      Its happening the same for me too. The SMTP status is “connected” but it shows that error message on the top of the page.

      Reply
      • Jon says

        I’m having the same issue. I’m testing as a lighter alternative to other SMTP plugins. Seems like a bug to me.

        Reply
  11. Simon says

    Hi there,

    I tried this smtp plugin, but I can’t pass the last step – every time I clicked the “Allow” in the google permission page, it will take me to a 403 Forbidden page….

    Don’t know why. Any clue or suggestion?

    Thanks!

    Reply
  12. Alessandro Cruz says

    The From Email Address field has one email address, but the sender on the test emails is my Gmail account that I used to configure the plugin. Any thoughts on how to fix it?

    Reply
    • Lisa says

      Did you figure this out?

      I wanted emails to be “from” my support group (support@domain.com), which I am a member of. I had to authorize it from my user account.

      But the emails arrive from my useraccount (me@domain.com) instead.

      Everything else works NICELY…

      Reply
  13. LB says

    Hello

    I’m running
    – WP 5.3.2
    – Gmail SMTP: 1.1.9
    – PHP: 7.3.14
    – TLS port 587

    I have set up a Gmail account with OAuth and copied the credentials into the plugin.

    I seem to be getting a problem with STARTTLS that’s causing the following:

    2020-02-06 18:03:01 Connection: opening to 127.0.0.1:25, timeout=300, options=array ()
    2020-02-06 18:03:01 Connection: opened
    2020-02-06 18:03:01 SMTP -> get_lines(): $data is “”
    2020-02-06 18:03:01 SMTP -> get_lines(): $str is “220 pool3-209-36.bur.atomicsites.net ESMTP Postfix (Debian/GNU)”
    2020-02-06 18:03:01 SERVER -> CLIENT: 220 pool3-209-36.bur.atomicsites.net ESMTP Postfix (Debian/GNU)
    2020-02-06 18:03:01 CLIENT -> SERVER: EHLO thegentletable.com
    2020-02-06 18:03:01 SMTP -> get_lines(): $data is “”
    2020-02-06 18:03:01 SMTP -> get_lines(): $str is “250-pool3-209-36.bur.atomicsites.net”
    2020-02-06 18:03:01 SMTP -> get_lines(): $data is “250-pool3-209-36.bur.atomicsites.net”
    2020-02-06 18:03:01 SMTP -> get_lines(): $str is “250-PIPELINING”
    2020-02-06 18:03:01 SMTP -> get_lines(): $data is “250-pool3-209-36.bur.atomicsites.net250-PIPELINING”
    2020-02-06 18:03:01 SMTP -> get_lines(): $str is “250-SIZE 10240000”
    2020-02-06 18:03:01 SMTP -> get_lines(): $data is “250-pool3-209-36.bur.atomicsites.net250-PIPELINING250-SIZE 10240000”
    2020-02-06 18:03:01 SMTP -> get_lines(): $str is “250-VRFY”
    2020-02-06 18:03:01 SMTP -> get_lines(): $data is “250-pool3-209-36.bur.atomicsites.net250-PIPELINING250-SIZE 10240000250-VRFY”
    2020-02-06 18:03:01 SMTP -> get_lines(): $str is “250-ETRN”
    2020-02-06 18:03:01 SMTP -> get_lines(): $data is “250-pool3-209-36.bur.atomicsites.net250-PIPELINING250-SIZE 10240000250-VRFY250-ETRN”
    2020-02-06 18:03:01 SMTP -> get_lines(): $str is “250-AUTH PLAIN”
    2020-02-06 18:03:01 SMTP -> get_lines(): $data is “250-pool3-209-36.bur.atomicsites.net250-PIPELINING250-SIZE 10240000250-VRFY250-ETRN250-AUTH PLAIN”
    2020-02-06 18:03:01 SMTP -> get_lines(): $str is “250-ENHANCEDSTATUSCODES”
    2020-02-06 18:03:01 SMTP -> get_lines(): $data is “250-pool3-209-36.bur.atomicsites.net250-PIPELINING250-SIZE 10240000250-VRFY250-ETRN250-AUTH PLAIN250-ENHANCEDSTATUSCODES”
    2020-02-06 18:03:01 SMTP -> get_lines(): $str is “250-8BITMIME”
    2020-02-06 18:03:01 SMTP -> get_lines(): $data is “250-pool3-209-36.bur.atomicsites.net250-PIPELINING250-SIZE 10240000250-VRFY250-ETRN250-AUTH PLAIN250-ENHANCEDSTATUSCODES250-8BITMIME”
    2020-02-06 18:03:01 SMTP -> get_lines(): $str is “250 DSN”
    2020-02-06 18:03:01 SERVER -> CLIENT: 250-pool3-209-36.bur.atomicsites.net250-PIPELINING250-SIZE 10240000250-VRFY250-ETRN250-AUTH PLAIN250-ENHANCEDSTATUSCODES250-8BITMIME250 DSN
    2020-02-06 18:03:01 CLIENT -> SERVER: STARTTLS
    2020-02-06 18:03:01 SMTP -> get_lines(): $data is “”
    2020-02-06 18:03:01 SMTP -> get_lines(): $str is “502 5.5.1 Error: command not implemented”
    2020-02-06 18:03:01 SERVER -> CLIENT: 502 5.5.1 Error: command not implemented
    2020-02-06 18:03:01 SMTP ERROR: STARTTLS command failed: 502 5.5.1 Error: command not implemented
    SMTP Error: Could not connect to SMTP host.
    2020-02-06 18:03:01 CLIENT -> SERVER: QUIT
    2020-02-06 18:03:01 SMTP -> get_lines(): $data is “”
    2020-02-06 18:03:01 SMTP -> get_lines(): $str is “221 2.0.0 Bye”
    2020-02-06 18:03:01 SERVER -> CLIENT: 221 2.0.0 Bye
    2020-02-06 18:03:01 Connection: closed
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    As a result, no email can be sent from the site. I’ve tried turning off plugins, no change. … tried using both encryption types and their respective ports as well as disabling SSL verification. Those options produce different errors, but none allow me to send email.

    Can you point me in the right direction?

    Thanks

    Reply
  14. Diu says

    hello!

    It works on my web site well.

    How could I customize the content of the registion Email. It’s too simple…….

    Thanks!

    Reply
  15. Amateo Seno says

    You need to update your installation instructions. The Google Developer Console has changed. There are subtle differences from what your instructions show and there are omissions possibly due to your instructions not being updated. I wasted over 2 hours trying to figure out the gaps. I finally gave up and searched for another plugin which had a simpler process and instructions that matched exactly what you see in the Google Developer Console. I strongly advise that you update your installation instructions .

    Reply
  16. Melanie says

    This tutorial video is too outdated to use. I am going to have to disable my contact page. I can’t get emails to send. boo. please let me know if you update it. I am done for now.

    Reply
    • Noor Alam says

      @Melanie, The documentation has already been updated.

      Reply
  17. AG Sasidar says

    Please anybody help me for this case:-

    The error mesage like this:
    2020-06-02 08:04:59 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ( ‘ssl’ => array ( ‘verify_peer’ => false, ‘verify_peer_name’ => false, ‘allow_self_signed’ => true, ),)
    2020-06-02 08:04:59 Connection failed. Error #2: stream_socket_client(): unable to connect to smtp.gmail.com:587 (Network is unreachable) [/srv/disk1/3356389/www/agsasidar.com/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 298]
    2020-06-02 08:04:59 SMTP ERROR: Failed to connect to server: Network is unreachable (101)
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    I don’t know, how to solve it. Please help me to solve this problems

    Reply
    • Alejandro says

      I have the same error, can anyone help us?

      Reply
      • Quoc Anh says

        I have same issue today. Does anyone has solution?

        Reply
  18. M Hari Basker says

    Is their any restriction by Google if we send 300 emails in a single shot as notification to all website registered by using this Plugin. We have tried to send by using this plugin and our configured email account get freezed for few minutes and no email get triggered. Do you have any idea and solution for this.

    Please let me know

    Reply
  19. Peter Lee Harrison says

    I’m getting “There has been a critical error on your website. Please check your site admin email inbox for instructions.”

    I can go back into the site but the gmail status is unset

    Reply
  20. manthan turakhia says

    2020-07-26 15:49:48 Connection: opening to ssl://smtp.gmail.com:587, timeout=10, options=array ( ‘ssl’ => array ( ‘verify_peer’ => false, ‘verify_peer_name’ => false, ‘allow_self_signed’ => true, ),)
    2020-07-26 15:49:49 Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:error:1408F10B:SSL routines:ssl3_get_record:wrong version number [/home/printitnice/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 298]
    2020-07-26 15:49:49 Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [/home/printitnice/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 298]
    2020-07-26 15:49:49 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:587 (Unknown error) [/home/printitnice/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 298]
    2020-07-26 15:49:49 SMTP ERROR: Failed to connect to server: (0)
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    Reply
    • Noor Alam says

      @manthan, Please contact your web host to make sure that port 587 is open and supports TLS encryption.

      Reply
« Older Comments
Newer Comments »

Leave a Reply Cancel reply

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

Primary Sidebar

Search WP HowTo

Recent Posts

  • How To Disable Sticky Header in a Genesis Child Theme
  • How to Center a Tweet in WordPress
  • How to Add a Free SSL Certificate to Your WordPress Site
  • 34 Best Black Friday & Cyber Monday Discounts for WordPress (2019)
  • Introducing to WordPress Login & Admin Area on Bluehost

Top Posts & Pages

  • Gmail SMTP Plugin for WordPress
    Gmail SMTP Plugin for WordPress
  • WordPress PayPal Plugin
    WordPress PayPal Plugin
  • How to Embed a Video in WordPress
    How to Embed a Video in WordPress
  • Videojs HTML5 Player For WordPress
    Videojs HTML5 Player For WordPress
  • SMTP Mailer Plugin For WordPress
    SMTP Mailer Plugin For WordPress
  • How to Remove/Hide Image From WooCommerce Product Page
    How to Remove/Hide Image From WooCommerce Product Page
  • How to Create a PayPal Subscription Button in WordPress
    How to Create a PayPal Subscription Button in WordPress
  • Best Cheap WordPress Hosting (2020)
    Best Cheap WordPress Hosting (2020)
  • WordPress Plugins
    WordPress Plugins
  • 6 Free WordPress PayPal Subscription Plugins for Accepting Recurring Payments
    6 Free WordPress PayPal Subscription Plugins for Accepting Recurring Payments

Copyright © 2021 · WordPress HowTo

This website uses cookies to improve your experience. By continuing, you agree to their use.Got it! Learn More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled

Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.

Non-necessary

Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.