Title: Gmail smtp php error
Last modified: May 16, 2019

---

# Gmail smtp php error

 *  Resolved [develhem](https://wordpress.org/support/users/develhem/)
 * (@develhem)
 * [7 years ago](https://wordpress.org/support/topic/gmail-smtp-php-error/)
 * Hello, i use your plugin since many time but, i have a big problem now. When 
   i execute an action sending an email (forgot password, test mail from smtp panel,
   ect.), i have this pretty message :
 * Fatal error: Uncaught LogicException: refresh token must be passed in or set 
   as part of setAccessToken in /wp-content/plugins/gmail-smtp/google-api-php-client/
   src/Google/Client.php:267 Stack trace: #0 /wp-content/plugins/gmail-smtp/google-
   api-php-client/src/Google/Client.php(255): Google_Client->fetchAccessTokenWithRefreshToken(
   NULL) #1 /wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(144): 
   Google_Client->refreshToken(NULL) #2 /wp-content/plugins/gmail-smtp/PHPMailer/
   class.smtp.php(475): GmailXOAuth2->getOauth64() #3 /wp-content/plugins/gmail-
   smtp/class.phpmaileroauth.php(152): SMTP->authenticate(”, ”, ‘XOAUTH2’, ”, ”,
   Object(GmailXOAuth2)) #4 /wp-content/plugins/gmail-smtp/PHPMailer/class.phpmailer.
   php(1542): PHPMailerOAu in /wp-content/plugins/gmail-smtp/google-api-php-client/
   src/Google/Client.php on line 267

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Noor Alam](https://wordpress.org/support/users/naa986/)
 * (@naa986)
 * [7 years ago](https://wordpress.org/support/topic/gmail-smtp-php-error/#post-11575090)
 * [@develhem](https://wordpress.org/support/users/develhem/), Try doing a fresh
   authorization and see how it goes: [https://wphowto.net/gmail-smtp-plugin-for-wordpress-1341](https://wphowto.net/gmail-smtp-plugin-for-wordpress-1341)
 *  [morespinach](https://wordpress.org/support/users/morespinach/)
 * (@morespinach)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/gmail-smtp-php-error/#post-11994044)
 * Same issue. My error message below. When we have gone through the dance of creating
   client ID etc (Google’s design of this UI sucks), why is your plugin trying to
   initiate “username and password” stuff?
 *     ```
       2019-10-03 16:14:44 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ()
       2019-10-03 16:14:44 Connection: opened
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is ""
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "220 smtp.gmail.com ESMTP n10sm1893467ilh.53 - gsmtp"
       2019-10-03 16:14:45 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP n10sm1893467ilh.53 - gsmtp
       2019-10-03 16:14:45 CLIENT -> SERVER: EHLO MYDOMAIN.COM
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is ""
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]"
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]"
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250-SIZE 35882577"
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]250-SIZE 35882577"
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250-8BITMIME"
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]250-SIZE 35882577250-8BITMIME"
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250-STARTTLS"
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]250-SIZE 35882577250-8BITMIME250-STARTTLS"
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250-ENHANCEDSTATUSCODES"
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES"
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250-PIPELINING"
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING"
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250-CHUNKING"
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING"
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250 SMTPUTF8"
       2019-10-03 16:14:45 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
       2019-10-03 16:14:45 CLIENT -> SERVER: STARTTLS
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is ""
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "220 2.0.0 Ready to start TLS"
       2019-10-03 16:14:45 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
       2019-10-03 16:14:45 CLIENT -> SERVER: EHLO MYDOMAIN.COM
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is ""
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]"
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]"
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250-SIZE 35882577"
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]250-SIZE 35882577"
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250-8BITMIME"
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]250-SIZE 35882577250-8BITMIME"
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH"
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH"
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250-ENHANCEDSTATUSCODES"
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES"
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250-PIPELINING"
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING"
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250-CHUNKING"
       2019-10-03 16:14:45 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING"
       2019-10-03 16:14:45 SMTP -> get_lines(): $str is "250 SMTPUTF8"
       2019-10-03 16:14:45 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [2604:a880:cad:d0::6870:2001]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
       2019-10-03 16:14:45 Auth method requested: XOAUTH2
       2019-10-03 16:14:45 Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH
       2019-10-03 16:14:46 CLIENT -> SERVER: AUTH XOAUTH2 dXNlcj1pbmZvQGVzdGRvY3MuY29tAWF1dGg9QmVhcmVyIAEB
       2019-10-03 16:14:46 SMTP -> get_lines(): $data is ""
       2019-10-03 16:14:46 SMTP -> get_lines(): $str is "334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ=="
       2019-10-03 16:14:46 SERVER -> CLIENT: 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
       2019-10-03 16:14:46 SMTP ERROR: AUTH command failed: 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
       SMTP Error: Could not authenticate.
       2019-10-03 16:14:46 CLIENT -> SERVER: QUIT
       2019-10-03 16:14:46 SMTP -> get_lines(): $data is ""
       2019-10-03 16:14:46 SMTP -> get_lines(): $str is "535-5.7.8 Username and Password not accepted. Learn more at"
       2019-10-03 16:14:46 SMTP -> get_lines(): $data is "535-5.7.8 Username and Password not accepted. Learn more at"
       2019-10-03 16:14:46 SMTP -> get_lines(): $str is "535 5.7.8 https://support.google.com/mail/?p=BadCredentials n10sm1893467ilh.53 - gsmtp"
       2019-10-03 16:14:46 SERVER -> CLIENT: 535-5.7.8 Username and Password not accepted. Learn more at535 5.7.8 https://support.google.com/mail/?p=BadCredentials n10sm1893467ilh.53 - gsmtp
       2019-10-03 16:14:46 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 n10sm1893467ilh.53 - gsmtp
       2019-10-03 16:14:46 Connection: closed
       SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
       ```
   
    -  This reply was modified 6 years, 8 months ago by [morespinach](https://wordpress.org/support/users/morespinach/).

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Gmail smtp php error’ is closed to new replies.

 * ![](https://ps.w.org/gmail-smtp/assets/icon-128x128.png?rev=2432932)
 * [Gmail SMTP](https://wordpress.org/plugins/gmail-smtp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gmail-smtp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gmail-smtp/)
 * [Active Topics](https://wordpress.org/support/plugin/gmail-smtp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gmail-smtp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gmail-smtp/reviews/)

## Tags

 * [php-error](https://wordpress.org/support/topic-tag/php-error/)

 * 2 replies
 * 3 participants
 * Last reply from: [morespinach](https://wordpress.org/support/users/morespinach/)
 * Last activity: [6 years, 8 months ago](https://wordpress.org/support/topic/gmail-smtp-php-error/#post-11994044)
 * Status: resolved