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. Hello @Noor Alam,

    I have installed your plugin for WP and it works very nicely as advertised — I can use the Test Message just fine and email generated directly in WP is handled as expected. I have another plugin, CiviCRM, that generates email and it does not seem to work with your SMTP plugin. Do you have any suggestions about how I might get CiviCRM (or any other plugin) to use your SMTP plugin? Thank you.

    Reply
    • @Don, Can you please tell me what it’s doing? There shouldn’t be any issue unless it’s a SMTP plugin.

      Reply
      • Noor, CiviCRM (https://civicrm.org) is a WP plugin that provides a full constituent management app focused on non-profits. It includes a range of email connectivity options listed as mail(), smtp, snmp, none. My implementation is on an AWS t2.micro instance running Ubuntu 16.04/LAMP. Sendmail and postfix are not installed. Your plugin functions as advertised to link WP with GSuites GMail. When I try to use the available CiviCRM functions to connect to mail(), I get the following error message:

        —– begin error message —–
        Mail Not Sent
        Sending test email:
        From: info@chambermusicamici.org
        To: dvhirst@chambermusicamici.org
        Oops. Your MAIL settings are incorrect. No test mail has been sent.
        An error occurred when CiviCRM attempted to send an email (via SMTP). If you received this error after submitting on online contribution or event registration – the transaction was completed, but we were unable to send the email receipt.

        The mail library returned the following error message:
        mail() returned failure

        This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM » System Settings » Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:

        Your Sendmail path is incorrect.
        Your Sendmail argument is incorrect.
        The FROM Email Address configured for this feature may not be a valid sender based on your email service provider rules.
        Check this page for more information.
        —– end error message—–

        Looking at CiviCRM’s internal logging, I see this (may not be useful to you, it’s here in any case).

        —– begin log entry —–
        Jul 29 13:13:50 [error] Ignoring exception thrown by nullHandler: , mail() returned failure

        Jul 29 13:13:50 [debug] $backTrace = #0 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(935): CRM_Core_Error::backtrace(“backTrace”, TRUE)
        #1 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::nullHandler(Object(PEAR_Error))
        #2 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(577): PEAR_Error->__construct(“mail() returned failure”, NULL, 16, (Array:2), NULL)
        #3 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(236): PEAR::_raiseError(NULL, “mail() returned failure”)
        #4 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/mail/Mail/mail.php(175): PEAR::__callStatic(“raiseError”, (Array:1))
        #5 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Admin/Form/Setting/Smtp.php(187): Mail_mail->send(“dvhirst@chambermusicamici.org”, (Array:2), “mail settings are correct.”)
        #6 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(495): CRM_Admin_Form_Setting_Smtp->postProcess()
        #7 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Refresh.php(75): CRM_Core_Form->mainProcess()
        #8 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Refresh->perform(Object(CRM_Admin_Form_Setting_Smtp), “refresh”)
        #9 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Admin_Form_Setting_Smtp), “refresh”)
        #10 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle(“refresh”)
        #11 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Utils/Wrapper.php(114): CRM_Core_Controller->run()
        #12 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(257): CRM_Utils_Wrapper->run(“CRM_Admin_Form_Setting_Smtp”, “Outbound Email Settings”, (Array:0))
        #13 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:15))
        #14 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
        #15 /var/www/wordpress/wp-content/plugins/civicrm/civicrm.php(1465): CRM_Core_Invoke::invoke((Array:4))
        #16 /var/www/wordpress/wp-includes/class-wp-hook.php(287): CiviCRM_For_WordPress->invoke(“”)
        #17 /var/www/wordpress/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(“”, (Array:1))
        #18 /var/www/wordpress/wp-includes/plugin.php(478): WP_Hook->do_action((Array:1))
        #19 /var/www/wordpress/wp-admin/admin.php(254): do_action(“toplevel_page_CiviCRM”)
        #20 {main}
        —– end log entry—–

        At the moment, the alternative that seems workable to me is to install and configure PostFix to connect with GSuite SNMP-Relay service using the “less-secure app” configuration, though I realize this is not optimal.

        If you have any ideas for establishing a link between CiviCRM and your plugin, that would be great. There is a substantial community of nfp organizations that use CiviCRM/WordPress and I am quite certain I’m not the only one with this issue.

        I appreciate your willingness to engage in this discussion.

        Reply
        • @Don, Is this plugin invoking wp_mail (The function used in WordPress to send an email) or does it have its own mail function?

          Reply
          • @Noor, I believe it is using its own mail() function, not wp_mail. I will ask the question on the support channel to be certain.

          • @Don, Thanks. That’s probably why it’s not going through Gmail SMTP.

          • Yes, that makes good sense. I’m asking in the CiviCRM support channel if there is a way to point CiviCRM emails at the WP mail function.

            I’d ask you if shim code might be possible to link CiviCRM with your plugin?

            Thanks.

            Don

          • @Don, There is nothing to link. In order to send an email in WordPress the wp_mail function needs to be invoked. Otherwise WordPress or Gmail SMTP plugin has no idea that an email is being sent.

          • Yes, I recognize that, the shim code in question would link CiviCRM’s email functionality to use the wp_mail call, and that is the question I’ve raised with the CiviCRM/WordPress support channel. Hopefully, I will get a useful response. More when I know more.

  2. Since i updated to latest wordpress/woocommerce, this app didnt work.
    It wast serious error, check my admin mailbox. But I don’t get that email as well… :((((

    Reply
    • @Renato, It has been tested in WordPress 5.5

      Reply
  3. I have had a website set up for 2-3 years using your plugin set up and configured to use a gmail account without a problem however suddenly the WooCommerce emails have stopped being delivered. I did a test and it shows the following error at the end of the test report:

    2020-08-17 17:44:00 SMTP INBOUND: "535-5.7.8 Username and Password not accepted. Learn more at"
    2020-08-17 17:44:00 SMTP INBOUND: "535 5.7.8 https://support.google.com/mail/?p=BadCredentials t25sm28828219wmj.18 - gsmtp"
    2020-08-17 17:44:00 SERVER -> CLIENT: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8 https://support.google.com/mail/?p=BadCredentials t25sm28828219wmj.18 - gsmtp
    2020-08-17 17:44:00 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 t25sm28828219wmj.18 - gsmtp
    2020-08-17 17:44:00 Connection: closed
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    its a while since I set up the plugin but I have checked the gmail account and the app still seems to be there ok. As I understood it this method doesn’t use a username and password and nothing has been changed on the Gmail account. Do you have any ideas why this has stopped working mid July 2020?

    Reply
    • @Julie, The plugin doesn’t use your username/password for authentication. However, this error seems to occur after changing the password. Have you changed it recently? If not please try a fresh authorization (see the Fresh Authorization section for details) and see how it goes.

      Reply
      • I had the same problem as Julie which also started in July 2020. I followed your advice to do the Fresh Authorization and it worked perfectly.

        Thanks for the advice.

        Reply
  4. Hi ! Thank you a lot for these instructions. Sorry for my approximative english, but I have some troubleshooting with the test email. I’ve the latest version of PHPMailers

    With the 587, and the 25 TSL or SSL, i’ve this message :

    => Connection: opening to smtp.gmail.com:587 (or 25 lol), timeout=300, options=array()
    => Connection failed. Error #2: stream_socket_client(): unable to connect to smtp.gmail.com:587 (or 25) (Connection refused) [/home/thegreatqw/www/wp-includes/PHPMailer/SMTP.php line 344]
    => SMTP ERROR: Failed to connect to server: Connection refused (111)

    The code at the lane 344 in SMTP

    if ($streamok) {
    $socket_context = stream_context_create($options);
    set_error_handler([$this, ‘errorHandler’]);
    $this->smtp_conn = stream_socket_client(
    $host . ‘:’ . $port,
    $errno,
    $errstr,
    $timeout,
    STREAM_CLIENT_CONNECT,
    $socket_context
    );

    I tried change the port in 465, and i have this error :

    2020-08-18 16:33:34 Connection: opening to smtp.gmail.com:465, timeout=300, options=array()
    2020-08-18 16:33:34 Connection: opened
    2020-08-18 16:33:44 SMTP INBOUND: “”
    2020-08-18 16:33:44 SERVER -> CLIENT:
    2020-08-18 16:33:44 SMTP NOTICE: EOF caught while checking if connected
    2020-08-18 16:33:44 Connection: closed
    SMTP Error: Could not connect to SMTP host.
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    And now, i don’t see what could i do…

    Could you help me one more time ? 😀 Thank you a lot

    Reply
    • @Benjamin, It seems your server is not allowing the plugin to connect to the remote SMTP server. Please contact your host to make sure that port 587 is open and supports TLS encryption.

      Reply
  5. Hello – I am installing this plugin for a client. I used my own google account to set up a project in Google Developer Console. I then put my email address as the OAuth email address and my client’s business gmail as the from email address. The emails are now from the website are now showing as from me when they go out to customers. Is there a way to make it so the emails that go out show as from the business gmail? Or do I need to set up a Google Developer project using her account? Thanks!

    Reply
    • @Amanda, Google doesn’t allow this for security reasons.

      Reply
  6. Hello @Noor Alam,

    Thank you for the plug in. I am excited to get GMAIL integrated into a website that I am developing locally. I’ve follow all directions to the letter, including all the trouble-shooting tips, but when I test the email via the Plug-In settings, I still get the following log with error. Can you suggest to me what I might look at to see how this can be resolved?

    Thank you,

    George

    2020-08-26 04:35:21 Connection: opening to smtp.gmail.com:587, timeout=300, options=array()
    2020-08-26 04:35:21 Connection: opened
    2020-08-26 04:35:21 SMTP INBOUND: “220 smtp.gmail.com ESMTP w193sm845006qkb.115 – gsmtp”
    2020-08-26 04:35:21 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP w193sm845006qkb.115 – gsmtp
    2020-08-26 04:35:21 CLIENT -> SERVER: EHLO localhost
    2020-08-26 04:35:21 SMTP INBOUND: “250-smtp.gmail.com at your service, [2606:a000:121a:67b:98ea:b5f6:50b4:19ae]”
    2020-08-26 04:35:21 SMTP INBOUND: “250-SIZE 35882577”
    2020-08-26 04:35:21 SMTP INBOUND: “250-8BITMIME”
    2020-08-26 04:35:21 SMTP INBOUND: “250-STARTTLS”
    2020-08-26 04:35:21 SMTP INBOUND: “250-ENHANCEDSTATUSCODES”
    2020-08-26 04:35:21 SMTP INBOUND: “250-PIPELINING”
    2020-08-26 04:35:21 SMTP INBOUND: “250-CHUNKING”
    2020-08-26 04:35:21 SMTP INBOUND: “250 SMTPUTF8”
    2020-08-26 04:35:21 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2606:a000:121a:67b:98ea:b5f6:50b4:19ae]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2020-08-26 04:35:21 CLIENT -> SERVER: STARTTLS
    2020-08-26 04:35:21 SMTP INBOUND: “220 2.0.0 Ready to start TLS”
    2020-08-26 04:35:21 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
    2020-08-26 04:35:21 Connection failed. Error #2: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed [/Users/George/Local Sites/bikeroom/app/public/wp-includes/PHPMailer/SMTP.php line 426]
    SMTP Error: Could not connect to SMTP host.
    2020-08-26 04:35:21 CLIENT -> SERVER: QUIT
    2020-08-26 04:35:21
    2020-08-26 04:35:21
    2020-08-26 04:35:21
    2020-08-26 04:35:21 Connection: closed
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    Reply
    • @George, Have you disabled the ssl verify option in the settings? You may need to do this since you are using it on localhost.

      Reply
      • Thank you so much! Disabling the verify option did it. I first went down the path of making sure I had properly enabled SSL, and that was a fun learning experience, but that still didn’t work. So in the meantime, I receive your lightning fast response and disable the flag and bam; it works! Really appreciate it. alf shokr lak

        Reply
  7. Hi there.

    Great instructions. I downloaded a different plugin and where the instructions on that plugin failed, these didn’t. I have the Gmail API up and running, so I appreciate the effort that went creating these.

    Thank you,

    RC

    Reply
  8. Hi all,
    Every day I get an “Illegal string offset ‘refresh_token’ ” error and it doesnt work. I literally have to create new credentials and reauthorize access for it to work.
    Is there a way of preventing this from happening?

    Reply
    • @bkim, This occasionally happened on a few sites before (not every day though). I still don’t know why it happens.

      Reply
      • Yeah I guess every day is an exaggeration. It just feel like it’s every few days or so because whenever I check it gives that error, so I’m concerned that I’ve been missing out on getting emails so I try to check daily.

        Reply
  9. The plugin is working, but somehow I’m receiving both the form submission email and confirmation email (which is being sent to a different email than mine?). Any ideas on what might cause this?

    Reply
    • @Dan, No idea unfortunately. The plugin doesn’t automatically send any email. It only changes how an email is sent.

      Reply
  10. Salve, ottima guida e funziona tutto. L’unica cosa, anche avendo impostato in from email address un indirizzo diverso da OAuth Email Address, continuo a ricevere l’email con l’indirizzo email di OAuth. Anche rispondendo l’email arrivano su OAuth, è normale?

    Reply
  11. Hi, WHen I go through this and try and GRANT PERMISSION, I go through all the steps and at the end I get “FORBIDDEN You do not have permission to access this document.”

    Reply
  12. I’ve got error this..

    Error 403: access_denied
    The developer hasn’t given you access to this app. It’s currently being tested and it hasn’t been verified by Google. If you think you should have access, contact the developer (abdulmuktitop@gmail.com).
    Pelajari selengkapnya
    Minta Detail
    access_type=offline
    response_type=code
    redirect_uri=https://member.orderdisiniyuk.com/wp-admin/options-general.php?page=gmail-smtp-settings&action=oauth_grant
    flowName=GeneralOAuthFlow
    client_id=71836307786-qhf96hjev78rrnjbvu30ejbnttel04ja.apps.googleusercontent.com
    scope=https://mail.google.com/

    Reply
  13. Hey! thanks for developing this:

    I get this error message on the last step. Can you help?

    This app isn’t verified
    This app hasn’t been verified by Google yet. Only proceed if you know and trust the developer.

    If you’re the developer, submit a verification request to remove this screen. Learn more

    Advanced

    Thanks

    Reply
    • @Daisy, You can just click “Advanced” and Continue. The alternative is to have the app verified by Google (See Error #3 under Troubleshooting). I don’t think it’s important since you are the one who created the app.

      Reply
  14. Hello! Thank you for the instructions and error explanations.

    After clicking “Grant permission”, I saw an authorization error:

    “Error 403: access_denied
    The developer hasn’t given you access to this app. It’s currently being tested and it hasn’t been verified by Google. If you think you should have access, contact the developer (xxxxxxxxx@gmail.com)”

    Do you know why this happened? I’ve try another gmail as the developer email, it still got the same result.

    Reply
    • @Aurora, 1) Go to “Oauth consent screen” of your app and under “Test users” click “Add user”. Add the email address corresponding to your google account. 2) You may now get a different error – “This app isn’t verified”. If that happens click “Advanced” and continue.

      Reply
      • Thank you for your help. But I’m getting another authorization error instead.

        “Error 400: invalid_request”

        Reply
        • I created a new credential under the same project. Now it’s finally connected! Thank you so much!

          Reply
  15. hi, can you please help … i’m getting an error ”403 You do not have permission to access this document” right after at the end of the ‘grant permission’ process …

    Reply
    • @Bart, Please check the documentation.

      Reply
    • find a solution?

      Reply
  16. Hello My Friend..
    After I complete your steps I got an error as below:

    400 error : redirect_uri_mismatch
    The redirect URI in the request, http://www.consj.org/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/${your_client_id}?project=${your_project_number}.

    Would you please help me to fix it…

    Remark: My website is under establishing

    thanks
    and best regards

    Reply
  17. Hello My Friend

    I have fixed the error after I watched your video
    please ignore my previous message

    really: I was searching for a solution to setup my SMTP, and didn’t find it except in your plugin and your video
    thank you very much

    Reply
    • @Khalid, You’re welcome.

      Reply
  18. Emails stopped working on my site, and I get the following error after trying a test email:
    2021-01-30 20:34:38 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ( ‘ssl’ => array ( ‘verify_peer’ => false, ‘verify_peer_name’ => false, ‘allow_self_signed’ => true, ),)
    2021-01-30 20:34:38 Connection: opened
    2021-01-30 20:34:38 SMTP INBOUND: “220 smtp.gmail.com ESMTP d1sm2683409qtn.30 – gsmtp”
    2021-01-30 20:34:38 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP d1sm2683409qtn.30 – gsmtp
    2021-01-30 20:34:38 CLIENT -> SERVER: EHLO
    2021-01-30 20:34:38 SMTP INBOUND: “250-smtp.gmail.com at your service, [2607:f298:5:102f::dde:c59e]”
    2021-01-30 20:34:38 SMTP INBOUND: “250-SIZE 35882577”
    2021-01-30 20:34:38 SMTP INBOUND: “250-8BITMIME”
    2021-01-30 20:34:38 SMTP INBOUND: “250-STARTTLS”
    2021-01-30 20:34:38 SMTP INBOUND: “250-ENHANCEDSTATUSCODES”
    2021-01-30 20:34:38 SMTP INBOUND: “250-PIPELINING”
    2021-01-30 20:34:38 SMTP INBOUND: “250-CHUNKING”
    2021-01-30 20:34:38 SMTP INBOUND: “250 SMTPUTF8”
    2021-01-30 20:34:38 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2607:f298:5:102f::dde:c59e]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2021-01-30 20:34:38 CLIENT -> SERVER: STARTTLS
    2021-01-30 20:34:38 SMTP INBOUND: “220 2.0.0 Ready to start TLS”
    2021-01-30 20:34:38 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
    2021-01-30 20:34:38 CLIENT -> SERVER: EHLO
    2021-01-30 20:34:38 SMTP INBOUND: “250-smtp.gmail.com at your service, [2607:f298:5:102f::dde:c59e]”
    2021-01-30 20:34:38 SMTP INBOUND: “250-SIZE 35882577”
    2021-01-30 20:34:38 SMTP INBOUND: “250-8BITMIME”
    2021-01-30 20:34:38 SMTP INBOUND: “250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH”
    2021-01-30 20:34:38 SMTP INBOUND: “250-ENHANCEDSTATUSCODES”
    2021-01-30 20:34:38 SMTP INBOUND: “250-PIPELINING”
    2021-01-30 20:34:38 SMTP INBOUND: “250-CHUNKING”
    2021-01-30 20:34:38 SMTP INBOUND: “250 SMTPUTF8”
    2021-01-30 20:34:38 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2607:f298:5:102f::dde:c59e]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2021-01-30 20:34:38 Auth method requested: XOAUTH2
    2021-01-30 20:34:38 Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH
    2021-01-30 20:34:39 CLIENT -> SERVER: AUTH XOAUTH2 dXNlcj1hZG1pbkB0cmlhbmdsZWZyZWV0aG91Z2h0c29jaWV0eS5vcmcBYXV0aD1CZWFyZXIgAQE=
    2021-01-30 20:34:39 SMTP INBOUND: “334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==”
    2021-01-30 20:34:39 SERVER -> CLIENT: 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
    2021-01-30 20:34:39 SMTP ERROR: AUTH command failed: 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
    SMTP Error: Could not authenticate.
    2021-01-30 20:34:39 CLIENT -> SERVER: QUIT
    2021-01-30 20:34:39 SMTP INBOUND: “535-5.7.8 Username and Password not accepted. Learn more at”
    2021-01-30 20:34:39 SMTP INBOUND: “535 5.7.8 https://support.google.com/mail/?p=BadCredentials d1sm2683409qtn.30 – gsmtp”
    2021-01-30 20:34:39 SERVER -> CLIENT: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8 https://support.google.com/mail/?p=BadCredentials d1sm2683409qtn.30 – gsmtp
    2021-01-30 20:34:39 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 d1sm2683409qtn.30 – gsmtp
    2021-01-30 20:34:39 Connection: closed
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    Reply
    • @Marcus, The plugin doesn’t really use your username or password for authentication. Have you made any changes to your account recently?

      Reply
      • Yeah, I think the username/password error is just Google’s API saying it wasn’t authenticated and they didn’t differentiate the error between normal credentials and OAUTH.

        I don’t know exactly when the email sending stopped working. We did change the domain in the last few months, but I updated that in the Google API page.

        Reply
        • @Marcus, You can try to do a fresh authorization and see if it fixes the issue.

          Reply
  19. Hello, I have tried to configure the plugin following the steps in the tutorial, but when doing a test I get this error: There has been a critical error on this website. Please check your site admin email inbox for instructions.

    I don´t know why because i follow the stepts correctly.

    Reply
    • @Fiware, This error comes from WordPess. Can you please check if there is an error log on the server?

      Reply
  20. After successfully completing the authorization process I am still unable to receive mail. I am getting the following information:

    2021-03-03 20:21:54 Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array()
    2021-03-03 20:21:56 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused) [/home/nicoledi/public_html/wp-includes/PHPMailer/SMTP.php line 375]
    2021-03-03 20:21:56 SMTP ERROR: Failed to connect to server: Connection refused (111)
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    Reply
    • @Doug, Try TLS on port 587.

      Reply
      • I tried TLS on port 587 originally, same result.

        Reply
        • @doug, Your web host may have blocked these ports. Please contact them to make sure that port 587 is open and supports TLS encryption.

          Reply

Leave a Comment