Gmail SMTP Plugin for WordPress

Last updated on by admin

Gmail SMTP is an advanced SMTP mailing plugin for WordPress for sending 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 email. This is to make sure that users can still get full benefits of the default mail functionality.

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

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

How OAuth 2.0 Authorization Works

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

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

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

Requirements

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

Gmail SMTP Plugin Summary

Plugin Name: Gmail SMTP
Icon of Gmail SMTP
Description: Connect to Gmail SMTP server to automatically send email from your WordPress site. Configure wp_mail() to use SMTP with OAuth 2.0 authentication.
Rating: 4.1 based on 36 reviews
Price: 0 USD
Availability: instock

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

Settings

1. Click on the web application link in the plugin settings.

screenshot showing how to go to the google web application link from the gmail smtp plugin settings

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

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

screenshot showing how to register an application for gmail in the Google Developers Console

4. Once the project is created Gmail API should be automatically enabled.

5. Click Go to credentials.

screenshot showing that gmail api has been enable on the project

6. Click Add Credentials and select OAuth 2.0 client ID.

screenshot showing how to add oauth credentials to access gmail api

7. Click Configure consent screen.

screenshot showing how to configure consent screen to create an oauth client id

8. Enter a product name for the OAuth consent screen (e.g. Gmail SMTP) and click Save.

screenshot showing the oauth consent screen in the google developers console

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

10. 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 are of the plugin.

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

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

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

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

screenshot of gmail smtp settings

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

Test Email

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

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

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

Troubleshooting

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

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

smtp connect() failed

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

This error usually occurs when Gmail blocks a 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 login (Just click on the link that shows up in that message), the plugin should be able to connect to the Gmail SMTP server.

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 to refresh the OAuth2 token using the secret access key. It is required by the App that you created in your account to access the Gmail API. Usually the issue goes away when you delete the existing secret access key from the database and do a fresh authorization. For details please check the “Fresh Authorization” section.

OpenSSL Certificate Verification Failure

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

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

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

Fresh Authorization / Removing Access From the Application

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

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

screenshot showing the revoke access settings of gmail smtp plugin

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

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

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

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

Once this token is deleted the plugin can no longer connect to the Gmail SMTP server or send 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. It will start from the Allow consent screen.

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

If you like Gmail SMTP please leave it a rating. A huge thanks in advance!

162 thoughts on “Gmail SMTP Plugin for WordPress”

  1. Hi,
    I’ve followed all the intructions and I’m getting the following error bellow. Any ideas? Tried every combinations of ports and encriptions with no success.

    Thanks

    SERVER -> CLIENT: 220 2.0.0 Ready to start TLS

    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 /home/storage/9/08/35/agenciagdm/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php on line 343
    SMTP Error: Could not connect to SMTP host.
    CLIENT -> SERVER: QUIT
    SMTP -> get_lines(): $data is ""
    Connection: closed
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
    Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    1. @Ricardo, It looks like there is an issue in your SSL configuration.

      https://github.com/PHPMailer/PHPMailer/issues/368

      I can add a tweak in the plugin so it doesn’t verify the certificate. But I think you should try to get your hosting to fix the certificate (PHP 5.6 made this change for a good reason).

      1. I have released an update to address this issue. You can now disable SSL certificate verification in the settings, If you are unable to get your host to fix SSL configuration on the server.

  2. Hi, i’ve followed all the instructions and have this error

    SMTP Error: Could not authenticate.
    CLIENT -> SERVER: QUIT
    SMTP -> get_lines(): $data is ""
    SMTP -> get_lines(): $str is "221 host.t2tagency.com closing connection"
    SERVER -> CLIENT: 221 host.t2tagency.com closing connection
    Connection: closed
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    It’s a problem with the server?

      1. Same error as above:

        SMTP Error: Could not authenticate.

        No email in the auth email inbox. Tried revoking and deleting the auth. No luck.

        Please advice

        1. @Elliotr, Please contact your host to make sure port 587 is open and supports TLS encryption. Please also copy and paste content from the “Server Info” tab so I can take a look.

  3. Really great plugin! I already have it running on a couple of client sites.

    Im encountering one annoying thing though – I can’t seem to change the “From Email Address” – everytime I receive an email the from email is always the defined “OAuth Email Address”.
    It seems that the defined “From Email Address” is ignored.

    Note: The email I have defined in “From Email Address” is a custom@clientdomain.com = not a gmail/google domain, not sure if that has anything to say?

    When sending the test email I see the correct “From Email Address”, however when I receive the email and reply to it, then it shows the “OAuth Email Address”.

    Anyone experienced the same issue?

    TEST EMAIL SNIPPET:
    CLIENT -> SERVER: Date: Wed, 11 May 2016 22:08:31 +0000
    CLIENT -> SERVER: To: my@email.com
    CLIENT -> SERVER: From: Company
    CLIENT -> SERVER: Subject: Test mail

    1. ok the EMAIL SNIPPET didn’t print out well in the comment 🙂 Eitherways, bottomline is that I see the right “From Email Address” in the test email log

    2. There is a solution. You must go to your account settings in gmail> accounts and import> Send email as:> Add another email address

      Follow the procedures to add custom@clientdomain.com

      Once added, will work custom@clientdomain.com defined in “From Email Address” in the plugin’s settings.

  4. Hi,

    I am facing an unusual problem in that the configuration seems fine and the test email response doesn’t mention any errors, but none of the test emails are actually reaching their destinations. Here are some more details about my setup:

    Google: Using Google Apps for Business. Have set up OAuth as suggested and the Gmail SMTP settings shows a green checkmark.

    Domain: Domain is on Godaddy. MX records were set by Google Apps for Business automatically when I had signed up with them for email. I am unable to find any settings on Godaddy where I can change MX settings to “remote”, so that is one of the few steps from previous comments that I could not properly follow.

    Hosting: Hosting is on Digital Ocean.

    On trying to send Test Email, this is what I get:

    Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array ()
    Connection: opened
    SMTP -> get_lines(): $data is ""
    SMTP -> get_lines(): $str is "220 smtp.gmail.com ESMTP q19sm6609949qhb.20 - gsmtp"
    SERVER -> CLIENT: 220 smtp.gmail.com ESMTP q19sm6609949qhb.20 - gsmtp
    CLIENT -> SERVER: EHLO allonzy.in
    SMTP -> get_lines(): $data is ""
    SMTP -> get_lines(): $str is "250-smtp.gmail.com at your service, [162.243.2.17]"
    SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [162.243.2.17]"
    SMTP -> get_lines(): $str is "250-SIZE 35882577"
    SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [162.243.2.17]250-SIZE 35882577"
    SMTP -> get_lines(): $str is "250-8BITMIME"
    SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [162.243.2.17]250-SIZE 35882577250-8BITMIME"
    SMTP -> get_lines(): $str is "250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH"
    SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [162.243.2.17]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH"
    SMTP -> get_lines(): $str is "250-ENHANCEDSTATUSCODES"
    SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [162.243.2.17]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES"
    SMTP -> get_lines(): $str is "250-PIPELINING"
    SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [162.243.2.17]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING"
    SMTP -> get_lines(): $str is "250-CHUNKING"
    SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [162.243.2.17]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING"
    SMTP -> get_lines(): $str is "250 SMTPUTF8"
    SERVER -> CLIENT: 250-smtp.gmail.com at your service, [162.243.2.17]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    Auth method requested: XOAUTH2
    Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH

    My Server Details:

    OS: Linux ubuntu-512mb-nyc2-01 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
    PHP version: 5.5.9-1ubuntu4.14
    WordPress version: 4.5.1
    WordPress multisite: No
    openssl: Available
    allow_url_fopen: Enabled
    stream_socket_client: Available
    fsockopen: Available

    Any idea on how to troubleshoot this? I am at a dead-end. I have no other mail plugins setup.

    1. I sorted it out! 🙂

      On checking the apache2 error logs, found that curl_inti() was not being found. Basically, curl was not installed on the server. Installed php5-curl, restarted server and the test email went through.

      Thanks for the awesome plugin! 😀

    2. Same problem here, but it was working before.

      I have no ssh access to the server. Is there any other solution rather than installing php5-curl?

    3. I sorted it out.
      The website admin had changed the password and the authentication token became invalid.
      Did a fresh authentication and it’s working fine again 🙂

  5. Hi Admin,

    I’m having problem in grant permission. I keep getting HTTP ERROR 500: MySite is currently unable to handle this request. Where it cannot redirect after I click ALLOW
    My Server:

    OS: Windows NT NSTPNIE 5.2 build 3790 (Windows Server 2003 R2 Standard Edition Service Pack 2) i586
    PHP version: 5.4.31
    WordPress version: 4.5.2
    WordPress multisite: No
    openssl: Available
    allow_url_fopen: Enabled
    stream_socket_client: Available
    fsockopen: Available

    1. @Hardy, I can’t really troubleshoot this since I’m not logged into your gmail account. If it’s an issue on the developers console you should probably try it again later.

      1. Ok, do you what this error mean:

        Fatal error: Uncaught exception 'Google_IO_Exception' with message 'Failed to connect to accounts.google.com port 443: Timed out' in X:\XXX\XXX\wp-content\plugins\gmail-smtp\google-api-php-client\src\Google\IO\Curl.php:115 Stack trace: #0 X:\XXX\XXX\wp-content\plugins\gmail-smtp\google-api-php-client\src\Google\IO\Abstract.php(136): Google_IO_Curl->executeRequest(Object(Google_Http_Request)) #1 X:\XXX\XXX\wp-content\plugins\gmail-smtp\google-api-php-client\src\Google\Auth\OAuth2.php(111): Google_IO_Abstract->makeRequest(Object(Google_Http_Request)) #2 X:\XXX\XXX\wp-content\plugins\gmail-smtp\google-api-php-client\src\Google\Client.php(128): Google_Auth_OAuth2->authenticate('4/VcjFJ9yZzCgPx...', false) #3 X:\XXX\XXX\wp-content\plugins\gmail-smtp\class.phpmaileroauthgoogle.php(99): Google_Client->authenticate('4/VcjFJ9yZzCgPx...') #4 X:\XXX\XXX\wp-content\plugins\gmail-smtp\main.php(132): GmailXOAuth2::resetCredentials('4/VcjFJ9yZzCgPx...') #5 [internal function]: GMAIL_SMTP->plugin in X:\XXX\XXX\wp-content\plugins\gmail-smtp\google-api-php-client\src\Google\IO\Curl.php on line 115

        1. @Hardy, I’m not sure what this error means either. I did some research with the error message. Some users are saying it’s a firewall issue on the server.

  6. Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array ()
    SMTP ERROR: Failed to connect to server: Connection refused (111)
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    OS: Linux n1plcpnl0005.prod.ams1.secureserver.net 2.6.32-673.8.1.lve1.4.3.el6.x86_64 #1 SMP Wed Feb 10 08:57:30 EST 2016 x86_64
    PHP version: 5.4.43
    WordPress version: 4.5.2
    WordPress multisite: No
    openssl: Available
    allow_url_fopen: Enabled
    stream_socket_client: Available
    fsockopen: Available

    I am using google apps gmail. Tell me whats going on please. 🙂

  7. I get the following error:

    “400. That’s an error.

    Error: invalid_request

    Missing required parameter: client_id”

  8. I love this plugin very much, but just wondering about one eFatal error: Uncaught Google_Auth_Exception: Error refreshing the OAuth2 token, message: ‘{ “error” : “invalid_grant” }’ in /home/ediblyco/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Auth/OAuth2.php:363 Stack trace: #0 /home/ediblyco/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Auth/OAuth2.php(276): Google_Auth_OAuth2->refreshTokenRequest(Array) #1 /home/ediblyco/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php(457): Google_Auth_OAuth2->refreshToken(‘1/2ME6Ob2yBVkie…’) #2 /home/ediblyco/public_html/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(142): Google_Client->refreshToken(‘1/2ME6Ob2yBVkie…’) #3 /home/ediblyco/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php(471): GmailXOAuth2->getOauth64() #4 /home/ediblyco/public_html/wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(152): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”, Object(GmailXOAuth2)) #5 /home/ediblyco/public_html/wp-cont in /home/ediblyco/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Auth/OAuth2.php on line 363rror for authorization.

    This is error causing by this plugin.. so could you please help me for this issue?
    Thanks

    1. @Lowell, Please do the steps outlined in the “Fresh Authorization” section and see how it goes. Can you copy and paste the content from your “Server Info” tab?

  9. I did all the set up again but I’m getting this message now

    401. That’s an error.

    Error: deleted_client

    The OAuth client was deleted.

    Request Details
    response_type=code
    redirect_uri=https://roynuesca.com/wp-admin/options-general.php?page=gmail-smtp-settings&action=oauth_grant
    client_id=188060277206-j9l99p8um19mi0411hkrfuvuhmmaj1ig.apps.googleusercontent.com
    scope=https://mail.google.com/
    access_type=offline
    approval_prompt=auto

    1. @Roy, Did you delete the app from your account? If so and you created a new app, please update the client ID and Client Secret in the settings.

      1. I went to the app section in my account and It wasn’t there. So I created a new app and updated everything but still nothing 🙁 I tried multiple times, and everytime I click grant permission, I get that error

        401. That’s an error.

        Error: deleted_client

        The OAuth client was deleted.

        Request Details
        response_type=code
        redirect_uri=https://roynuesca.com/wp-admin/options-general.php?page=gmail-smtp-settings&action=oauth_grant
        client_id=188060277206-j9l99p8um19mi0411hkrfuvuhmmaj1ig.apps.googleusercontent.com
        scope=https://mail.google.com/
        access_type=offline
        approval_prompt=auto

  10. Hi, I followed all the steps, even update the wordpress version to 4.7.2. I have a problem when I redirect to the gmail permissions page I authorize and it goes to a blank page and it stays in that page without doing anything. Thank you

  11. Hi, first of all thanks for your great plugin.
    We have encountered the following error when doing some tasks like user creation, user password change, cloning site with ns cloner plugin. Trying to do those things lead to a blank page and leaves tasks half done.

    PHP Fatal error: Cannot declare class PHPMailer, because the name is already in use in /var/www/html/wp-includes/class-phpmailer.php on line …

    We are running 4.7.2, coming from earlier versions which I don’t remember having any of the above mentioned issues.
    Any idea why this is happening now? Thank you.

    1. @Eneko, Thank you for your kind words. For some reason I don’t see any error on my development site when I update a user. So this may have something to do with the plugin that you are using. Does it use the PHPMailer library?

      1. Is there an easy way I can check if any of the plugins uses PHPMailer library?
        I tried deactivating NS Cloner and leaving your plugin active and it fails.
        Deactivating GMAIL SMTP plugins makes wordpress work without issues, including the tasks mentioned above.

  12. Information required to set up API on Google is incomplete.

    Maybe the google side has been changed as there are specific questions asked that there are no guidelines for on this page.

  13. Simple to set up, although did need a bit of head scratching because the documentation is no longer entirely correct after Google changed the way the Developer API works, and moved things around.

    A bit more of a concern to me though, is that the client ID and Secret are left in plain view on the settings page.

    Doesn’t this mean that if someone unauthorised gains access to the Admin, they can abuse those?

  14. Hi there

    I was really optimistic when I came across this plugin. It really seems like it should work. But for now, for me, it isn’t. Even after reading the troubleshooting. The following is the error message, can you suggest a solution:

    Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array ()
    Connection: Failed to connect to server. Error number 2. “Error notice: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Network is unreachable)
    SMTP ERROR: Failed to connect to server: Network is unreachable (101)
    SMTP connect() failed.

    I don’t know why gmail would be unreachable. It’s google for goodness sake. Anyway, any expert help that can solve this problem would be much appreciated

    David

    1. @David, Google server is not the issue here. The plugin is running on the web server you are using. And in order to send the email it needs to first make a connection to the gmail server. This type of issue usually occurs when the port in use is blocked by your hosting provider. Please contact them to make sure that port 587 and 465 are not blocked.

      1. @admin, I know that 587 is not open but I verified using an online tool that 465 is open. I was trying to use the 465 port with SSL.

        I can check with the host that there is nothing else I need to know. But if there are any other common reasons for the error I was getting I would appreciate knowing.

        Thanks and kind regards

        David

        1. @David, Gmail recommends TLS on port 587 (SSL is a bit older). So it would be better if they could keep that open.

  15. Hi,

    I cannot use this plugin with the same gmail address and google web application on different WordPress installations. It only works where first activated.
    However, “Grant access” workd and SMTP Status is “Connected”, but when trying to send Test email it sais “Username and Password not accepted”.

    Tony

  16. I thought this might be the solution to my problems…

    But when sending a test email, it hands for about 6 minutes with no error message except a timeout.

    I’m unsure how to fix it!

  17. Plugin works perfectly, but doesn’t work for lost password, it outputs.
    “The email could not be sent.
    Possible reason: your host may have disabled the mail() function.”

    1. @Jacon, Password reset feature seems to be working fine for me. You may have a plugin that is causing this issue?

  18. I have done all of the troubleshooting on this page for my gmail smtp but I am still getting this error.

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

    1. @Anthony, Please use port 587 instead. If it still doesn’t work contact your host to make sure port 587 is open and supports TLS encryption.

        1. @Anthony, If you ask GoDaddy they will say everything is fine on their end (you can try though). They actually have their own SMTP. So you may not be able to use your own SMTP on a GoDaddy server.

          1. They said I would need a programmer to tweak the plugin to make it work. Is there anything you can do

  19. Could you help me troubleshoot, please?

    Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
    Connection: Failed to connect to server. Error number 2. “Error notice: stream_socket_client(): unable to connect to smtp.gmail.com:587 (Network is unreachable)
    SMTP ERROR: Failed to connect to server: Network is unreachable (101)
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    Gmail whitelisted to 587.

      1. The host defaults 587 to closed, but has whitelisted smtp.gmail.com
        Just waiting on confirmation of TLS encryption support.

  20. I have set the plugin up successfully (I have the screen button and am authorized) but am not clear on how to actually send an email from WordPress. I would like to do so programmatically. I’m a skilled programmer so all I need is a code snippet or link to a page explaining the steps.

    1. @Brian, There is a test email option in the plugin that you can use to send a test email. Other than that, emails will usually be sent by a contact form plugin on your site or WordPress. The plugin’s job is to use the Gmail SMTP server to send an email instead of your server. This happens automatically in the backend when the wp_mail function is called by a plugin.

Leave a Reply

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