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.
Installation
You can install the Gmail SMTP plugin in one of the following ways:
Option 1 (Quick & Easy install)
- Go to Plugins->Add New from your WordPress admin dashboard
- Search for “gmail smtp naa986”
- Click Install once you have found it
Option 2 (Manual install)
- Download the zip version of the plugin
- Go to Plugins->Add New
- Click Upload Plugin
- Select the zip file on your computer
- Install it
Gmail SMTP Configuration
In order to get started with the plugin go to Settings->Gmail SMTP from your admin dashboard.
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.
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.
3. Choose how you want to configure and register your app. Since I’m not using G Suite I had to choose External.
4. Enter a name (e.g. Gmail SMTP) for the OAuth consent screen.
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.
6. Skip the Scopes screen.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Got it working, but it does not use my “From Address”, it uses my gmail account. What do I need to change?
Attorneys4Law
FROM Email set to:
info@attorneys4law.co.za
Cheers
https://wordpress.org/support/topic/the-email-address-which-will-be-used-a/
Dear Admin, I have been most satisfied with the plugin. After unfortunately upgrading today, the plugin doesn’t work due to the higher php minimum requirement, and my hosting company doesn’t want to upgrade it. It worked perfectly before.
Could you please send me a download a link for the former version of the plugin or write an advice on what I should change in the code, so that the former version of the plugin could work? I hope I could edit the one or more necessary files in notepad++ or other coding software, or in wordpress itself in the “edit plugin” section, to get the minimum php back to where it was. I wish I wouldn’t have clicked on update.
Thank you so very much indeed.
This is the problem message I got after trying a test mail:
wp-content/plugins/gmail-smtp/google-api-php-client/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 78
On the Previous versons section of wordpress.org/plugins/gmail-smtp/advanced/ I cannot download the former 1.1.4, it only allows to download the the 1.1.2 as the latest of previous versions. I installed it originally on the 18th Aug, I am uncertain which was the latest version at that time? Could you so please send a download link to the version that was the latest one at that time? It would so much of a help, I would really appreciate it.
UPDATE: I was successful, now it works with uploading the latest “older version” from wordpress.org/plugins/gmail-smtp/advanced
However, as written above, it is the 1.1.2 version, and 1.1.4 version might be safer to use (I originally started using the plugin at the 18th Aug).
So if there could be a downloading opportunity of 1.1.4, I would try it.
Thank you very much indeed.
Hi
Same issues as Margot above.
PHP Fatal error: Uncaught InvalidArgumentException: Invalid token format in /var/www/html/wordpress/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php:434nStack trace:n#0 /var/www/html/wordpress/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(138): Google_Client->setAccessToken(Array)n#1 /var/www/html/wordpress/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php(470): GmailXOAuth2->getOauth64()n#2 /var/www/html/wordpress/wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(152): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”, Object(GmailXOAuth2))n#3 /var/www/html/wordpress/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1540): PHPMailerOAuth->smtpConnect(Array)n#4 /var/www/html/wordpress/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1335): PHPMailer->smtpSend(‘Date: Sun, 17 S…’, ‘test\n’)n#5 /var/www/html/wordpress/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1213): PHPMailer->postSend()n#6 /var/www/html/wordpress/wp-content/plugins/gmail-smtp/ in /var/www/html/wordpress/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php on line 434, referer: swnabt.com.au/wp-admin/options-general.php?page=gmail-smtp-settings&action=test-email
@Dan, Please copy and paste the content from the “Server Info” tab so I can take a look.
@admin
It’s ok i fixed it. I saw another post somewhere about refreshing the authentication. So I revoked access and refreshed the authentication token and it worked.
Thanks
Thank you – I was having the same issues and this was the solution!
I did this as well, but the problem started again a few days later. There is definitely an issue with the plugin.
I am starting to see the same issue. Refreshing token will allow me send out one or two test mails. Then it stops working again.
Mysql provides some additional information:
mysql> select * from wp_options where option_name =”gmail_smtp_options”;
9705 | gmail_smtp_options | a:9:{s:15:”oauth_client_id”;s:72:””;s:19:”oauth_client_secret”;s:24:””;s:18:”oauth_access_token”;s:74:”{“error”:”invalid_grant”,”error_description”:”Code was already redeemed.”}”;s:16:”oauth_user_email”;s:23:”@gmail.com”;s:10:”from_email”;s:23:”@gmail.com”;s:9:”from_name”;s:8:””;s:18:”type_of_encryption”;s:3:”tls”;s:9:”smtp_port”;s:3:”587″;s:24:”disable_ssl_verification”;s:0:””;} | yes
Downgrading to 1.1.2 solved my issue.
I too am experiencing the same issues. When I try to login (Even when I try to go the plugins page in wp-admin) I get a 500 error. I tried to revoke and reauthenticate, and it did work for a time, but probably only a few days. It broke again, so I had to disable the plugin. I really want to use it, but I can’t because the error is confusing my users and causing other issues.
Here is my system info:
OS: Linux ip-###-##-##-## 4.4.0-1032-aws #41-Ubuntu SMP Mon Aug 14 13:08:44 UTC 2017 x86_64
PHP version: 7.0.22-0ubuntu0.16.04.1
WordPress version: 4.8.1
WordPress multisite: No
openssl: Available
allow_url_fopen: Enabled
stream_socket_client: Available
fsockopen: Available
cURL: Available
cURL Version: 7.47.0, OpenSSL/1.0.2g
Here is the error:
Notice: Undefined index: refresh_token in /var/www/html/———————/wp-content/plugins/gmail-smtp/main.php on line 681
Fatal error: Uncaught InvalidArgumentException: Invalid token format in /var/www/html/———————-/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php:434 Stack trace: #0 /var/www/html/———————-/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(138): Google_Client->setAccessToken(Array) #1 /var/www/html/———————-/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php(470): GmailXOAuth2->getOauth64() #2 /var/www/html/———————-/wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(152): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”, Object(GmailXOAuth2)) #3 /var/www/html/———————-/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1540): PHPMailerOAuth->smtpConnect(Array) #4 /var/www/html/———————-/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1335): PHPMailer->smtpSend(‘Date: Fri, 15 S…’, ‘This email was …’) #5 /var/www/html/———————-/wp-content/plug in /var/www/html/———————-/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php on line 434
I am getting a 405 error, I have W3 Total Cache installed, could that be interfering?
@nadine, When do you get this error? Do you also get an error message? Please copy and paste the content from the “Server Info” tab so I can take a look.
Hi! When I try to send a test email.
OS: Linux box670.bluehost.com 3.10.0-614.10.2.lve1.4.50.el6h.x86_64 #1 SMP Mon May 22 17:31:11 EDT 2017 x86_64
PHP version: 7.0.12
WordPress version: 4.8.2
WordPress multisite: No
openssl: Available
allow_url_fopen: Enabled
stream_socket_client: Available
fsockopen: Available
cURL: Available
cURL Version: 7.24.0, OpenSSL/1.0.0
I tried changing the port setting per your troubleshooting instructions, nothing is working.
@nadine, What error do you get when you send a test email? Have you tried SSL on port 443?
I just tried SSL port 443, still same error. “405 Not Allowed” error
I am still getting the following errors when sending test messages through the plugin…
InvalidArgumentException thrown
Invalid token format
Would running PHP 7 cause this problem?
@Andrew, The plugin has been tested in PHP 7.0.2. So unless the Google API client library is incompatible with a particular PHP version there shouldn’t be any issue. Please copy and paste the content from the “Server Info” tab so I can take a look.
Here is the server info you requested. Thanks in advance!
Gmail SMTP 1.1.5
WordPress 4.8.1
OS: Linux xxxxxxxxx 3.13.0-76-generic #120-Ubuntu SMP Mon Jan 18 15:58:41 UTC 2016 i686
PHP version: 7.0.22-0ubuntu0.16.04.1
WordPress version: 4.8.1
WordPress multisite: No
openssl: Available
allow_url_fopen: Enabled
stream_socket_client: Available
fsockopen: Available
cURL: Available
cURL Version: 7.47.0, OpenSSL/1.0.2g
I inserted a different email address in the “From Email Address” box on the plugin, but it is still emailing people with the gmail account email address. Please advise
https://wordpress.org/support/topic/the-email-address-which-will-be-used-a/
Please help me. I’m desperate.
I’ve done the setup procedure more than 10 times, and everything works correctly for one day. Then it just stops working.
Everything looks ok with the credentials on Google, and the plugin submission test does not return any errors in the debugger, but the message does not arrive either.
I know that if you re-do the whole setup procedure will work again for some time, and then stop.
What could be happening?
Server Info:
OS: Linux l70cnn0368 3.10.0-514.26.2.el7.x86_64 # 1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64
PHP version: 7.0.22
WordPress version: 4.8.2
WordPress multisite: No
openssl: Available
allow_url_fopen: Enabled
stream_socket_client: Available
fsockopen: Available
cURL: Available
cURL Version: 7.29.0, NSS / 3.21 Basic ECC
When someone leaves a comment under my blog posts, they get an error message (see below). The comment shows up for my approval and is visible at the end but the author of the comment doesn’t know that and they keep trying rewriting comments and every time they get that error message.
Fatal error: Uncaught exception ‘LogicException’ with message ‘refresh token must be passed in or set as part of setAccessToken’ in /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php:267 Stack trace: #0 /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php(255): Google_Client->fetchAccessTokenWithRefreshToken(NULL) #1 /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(143): Google_Client->refreshToken(NULL) #2 /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php(470): GmailXOAuth2->getOauth64() #3 /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(153): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”, Object(GmailXOAuth2)) #4 /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1540): PHPMailerOAuth->smtpConnect(Array) #5 /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmail in /home/rebeltra/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php on line 267
Possible solutions that I tried and that didn’t work:
-downgrading the plugin to the 1.1.1 version
-revoke and reauthenticate with 2 different credentials various times
Test emails get error message too. I’d like to emphasize – both the emails and comments get through to me. While I don’t see problems with sending/receiving emails, my biggest concern is the comment section. I’ve reached out to my hosting provider and Jatpack support and they couldn’t solve this saying I should contact the developer of the plugin. Please advise!
Thank you for the great plugin.
I also received the “Invalid token format” like others did. I installed the “WP Rollback” plugin wordpress.org/plugins/wp-rollback/ and rolled the plugin back to version 1.1.2. Then I revoked access following the instrucitons in the “Revoke Access” tab of the plugin, then granted permission again. It finally worked. There seems to be an issue with the current version.
Info from my “Server Info” tab is as follows:
OS: Linux pod-101100 3.13.0-129-generic #178-Ubuntu SMP Fri Aug 11 12:48:20 UTC 2017 x86_64
PHP version: 5.6.31-4+wpengine10
WordPress version: 4.8
WordPress multisite: No
openssl: Available
allow_url_fopen: Enabled
stream_socket_client: Available
fsockopen: Available
cURL: Available
cURL Version: 7.35.0, OpenSSL/1.0.1f
Team,
I’m trying to setup my WP site, to work with gmail plugin, but without luck. I can’t see any errors in the log:
2017-09-26 20:40:02 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ( ‘ssl’ => array ( ‘verify_peer’ => false, ‘verify_peer_name’ => false, ‘allow_self_signed’ => true, ),)
2017-09-26 20:40:02 Connection: opened
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “220 smtp.gmail.com ESMTP 92sm7056092wrq.83 – gsmtp”
2017-09-26 20:40:02 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP 92sm7056092wrq.83 – gsmtp
2017-09-26 20:40:02 CLIENT -> SERVER: EHLO vnext.pro
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-smtp.gmail.com at your service, [52.59.154.20]”
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-SIZE 35882577”
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-8BITMIME”
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-STARTTLS”
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-STARTTLS”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-ENHANCEDSTATUSCODES”
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-PIPELINING”
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-CHUNKING”
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250 SMTPUTF8”
2017-09-26 20:40:02 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2017-09-26 20:40:02 CLIENT -> SERVER: STARTTLS
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “220 2.0.0 Ready to start TLS”
2017-09-26 20:40:02 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2017-09-26 20:40:02 CLIENT -> SERVER: EHLO vnext.pro
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-smtp.gmail.com at your service, [52.59.154.20]”
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-SIZE 35882577”
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-8BITMIME”
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH”
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-ENHANCEDSTATUSCODES”
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-PIPELINING”
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250-CHUNKING”
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “250 SMTPUTF8”
2017-09-26 20:40:02 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [52.59.154.20]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2017-09-26 20:40:02 Auth method requested: XOAUTH2
2017-09-26 20:40:02 Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH
2017-09-26 20:40:02 CLIENT -> SERVER: QUIT
2017-09-26 20:40:02 SMTP -> get_lines(): $data is “”
2017-09-26 20:40:02 SMTP -> get_lines(): $str is “221 2.0.0 closing connection 92sm7056092wrq.83 – gsmtp”
2017-09-26 20:40:02 SERVER -> CLIENT: 221 2.0.0 closing connection 92sm7056092wrq.83 – gsmtp
2017-09-26 20:40:02 Connection: closed
————————
OS: Linux ip-172-31-33-48 3.13.0-119-generic #166-Ubuntu SMP Wed May 3 12:18:55 UTC 2017 x86_64
PHP version: 7.0.18
WordPress version: 4.8.2
WordPress multisite: No
openssl: Available
allow_url_fopen: Enabled
stream_socket_client: Available
fsockopen: Available
cURL: Available
cURL Version: 7.45.0, OpenSSL/1.0.2l
Would you please take a look?
Regards,
Niko
I’m also getting this error. Server information below.
OS: Linux sg3.fcomet.com 2.6.32-773.26.1.lve1.4.35.el6.x86_64 #1 SMP Tue Sep 26 06:34:34 EDT 2017 x86_64
PHP version: 7.1.10
WordPress version: 4.8.2
WordPress multisite: No
openssl: Available
allow_url_fopen: Enabled
stream_socket_client: Available
fsockopen: Available
cURL: Available
cURL Version: 7.54.0, OpenSSL/1.0.2k
Hi,
I’m using the Better Notifications for WordPress plugin to send email to all 150 users whenever a new post “Announcement” post is published. I installed the Gmail SMTP plugin because users with AOL addresses (yes, people still have those) weren’t getting those notifications. Now when I publish a new announcement, about 50 emails go out before the server coughs up blood and times out.
My site is running WordPress 4.8.2 on PHP 5.6. Any ideas?
thanks,
pq
Hi there,
I am receiving the following error do you know why?
Great walk through thank you!
Fatal error: Uncaught exception ‘InvalidArgumentException’ with message ‘Invalid token format’ in /var/sites/n/nelsonandpops.co.uk/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php:434 Stack trace: #0 /var/sites/n/nelsonandpops.co.uk/public_html/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(138): Google_Client->setAccessToken(‘{“error”:”inval…’) #1 /var/sites/n/nelsonandpops.co.uk/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php(470): GmailXOAuth2->getOauth64() #2 /var/sites/n/nelsonandpops.co.uk/public_html/wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(153): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”, Object(GmailXOAuth2)) #3 /var/sites/n/nelsonandpops.co.uk/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1540): PHPMailerOAuth->smtpConnect(Array) #4 /var/sites/n/nelsonandpops.co.uk/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1335): PHPMailer->smtpSend(‘Date: Fri, 29 S…’, ‘testn’) #5 /va in /var/sites/n/nelsonandpops.co.uk/public_html/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php on line 434
My server info is below:
OS: Linux lin-10-170-0-70.gridhost.co.uk 3.2.83 #2 SMP Thu Oct 27 13:06:55 BST 2016 x86_64
PHP version: 5.6.22
WordPress version: 4.8.2
WordPress multisite: No
openssl: Available
allow_url_fopen: Enabled
stream_socket_client: Available
fsockopen: Available
cURL: Available
cURL Version: 7.41.0, OpenSSL/1.0.2a
Fatal error: Uncaught exception ‘InvalidArgumentException’ with message ‘Invalid token format’ in /home/httpd/vhosts/inoxmontagen.ch/mim-inox.com/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php:434 Stack trace: #0 /home/httpd/vhosts/inoxmontagen.ch/mim-inox.com/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(138): Google_Client->setAccessToken(‘{“error”:”inval…’) #1 /home/httpd/vhosts/inoxmontagen.ch/mim-inox.com/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php(470): GmailXOAuth2->getOauth64() #2 /home/httpd/vhosts/inoxmontagen.ch/mim-inox.com/wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(153): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”, Object(GmailXOAuth2)) #3 /home/httpd/vhosts/inoxmontagen.ch/mim-inox.com/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1540): PHPMailerOAuth->smtpConnect(Array) #4 /home/httpd/vhosts/inoxmontagen.ch/mim-inox.com/wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.php(1335): PHPMailer->smtpSend(‘Date: Mon, 2 Oc…’ in /home/httpd/vhosts/inoxmontagen.ch/mim-inox.com/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php on line 434
-> Same error here, whats the solution for it?
Good day,
We use this plugin on our multisite.
It is working just perfect on the sites. Recently we tried to add the SMPT to our new site that we are launching.
And it is not working on the new site (all the old ones are working just perfect)
Firstly, it was not sending any emails with the error
Client -> SERVER: QUIT
instead of quit it should load OAUTH2 and then send the emial.
So i read the comments, i read the support and tried deleting the data in plugin and saving and deleting the project in developers console (fresh authorization) and reactivating the plugin.
Since then i can not Grant access at all
I get error :
“401. That’s an error.
Error: deleted_client
The OAuth client was deleted.”
Even though the client is not deleted. Tried it several times but cant seem to get past this anymore.
Do you think google could stopped my developers account after trying so many times creating new Oauth2 acces ? The account did not notified me that it did that so i do not believe it…
But anyway, anyone any suggestions or another plugin that might work?
As well, could it be that we upgraded the plugin and the other sites were set up before the update?
Kind regards,
Kristof
@Kristof, Are you using a separate set of OAuth2 credentials for your new site?
Please could you look at my comment above?
Is there a reason this plugin requests an auth scope beyond just gmail.send?
I am getting this: And have tried everything suggested above…. weh I test email this is what comes back.
2017-10-02 16:24:59 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
2017-10-02 16:25:01 Connection failed. Error #2: stream_socket_client(): unable to connect to smtp.gmail.com:587 (Connection refused) [/home/hairobse/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 294]
2017-10-02 16:25:01 SMTP ERROR: Failed to connect to server: Connection refused (111)
SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
I am trying to put the Gmail SMTP Plugin in on a site and when I test the email it says:
2017-10-02 16:24:59 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
2017-10-02 16:25:01 Connection failed. Error #2: stream_socket_client(): unable to connect to smtp.gmail.com:587 (Connection refused) [/home/hairobse/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 294]
2017-10-02 16:25:01 SMTP ERROR: Failed to connect to server: Connection refused (111)
SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
IT says that is connected and got notice on the gmail account but when I test it see above
@michael, Usually this error occurs when the port in question is blocked on the server. Who is your hosting provider? You need to contact them to make sure that port 587 is open and supports TLS encryption. Have you tried SSL on port 465 or 443?
Hi admin,
I would really appreciate a response to my query above.
Thanks,
Chloe
@Chloe, It seems to be an intermittent issue that’s affecting a few sites. I have tested the plugin on different servers running on different PHP versions. But I have not been able to reproduce it. It may have something to do with the Google API Client library that was updated recently. Can you please install version 1.1.2 and see how it goes?
https://wordpress.org/plugins/gmail-smtp/advanced/
@Chloe Yes I tried all the suggested settings and ports, I can try again-didn’t do the one you suggested, but will and let you know. Godaddy is the host.
@Michael, GoDaddy only allows their own SMTP configurations.
https://wordpress.org/support/topic/fixed-my-problem-with-godaddy-not-e-mailing-gravity-forms/
You can try SSL on port 443. If it doesn’t work you need to contact them to open port 587 for you. It also needs to support TLS encryption.
If all else fails you can set up their SMTP configurations in my other SMTP plugin: https://wordpress.org/plugins/smtp-mailer/
Yes I tried all the suggested settings and ports, I can try again. Godaddy is the host.
Tried that the STMP mailer ;
Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array ()
Connection: Failed to connect to server. Error number 2. “Error notice: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused)
SMTP ERROR: Failed to connect to server: Connection refused (111)
SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Talked to GOdaddy and they said they don’t have ports blocked, but also said have to have a private dedicated server to manipulate ports. THis is a new client, just noticed that they do not have SSL certificate, is that m must to do any of this?
i have this error during testing. please how can i fix it
2017-10-07 00:51:19 Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array ()
2017-10-07 00:51:21 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Network is unreachable) [/home/gchabmyy/public_html/wp-content/plugins/gmail-smtp/PHPMailer/class.smtp.php line 294]
2017-10-07 00:51:21 SMTP ERROR: Failed to connect to server: Network is unreachable (101)
SMTP connect() failed. github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
@Harvey, Usually this error occurs when the port in question is blocked on the server. Who is your hosting provider? You need to contact them to make sure that port 465 is open and supports SSL encryption. Have you tried TLS on port 587 or SSL on port 443?