Matas Vaitkevicius
Matas Vaitkevicius

Reputation: 61351

Gmail SMTP, CLIENT -> SERVER: AUTH XOAUTH2, SMTP ERROR: AUTH command failed: 334

I am trying to hook in Gmail SMTP v1.1.7 plugin.

I have already successfully activated it by going to google developer console, getting OAuth key

enter image description here

then connecting the plugin with Gmail

enter image description here

However when I try to send test email I get Authentication error

Server Info 2018-04-15 00:46:32 Connection: opening to smtp.gmail.com:587, timeout=300, options=array ( 'ssl' => array ( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true, ),)
2018-04-15 00:46:33 Connection: opened
2018-04-15 00:46:33 SMTP -> get_lines(): $data is ""
2018-04-15 00:46:33 SMTP -> get_lines(): $str is "220 smtp.gmail.com ESMTP e77sm21399032pfk.147 - gsmtp"
2018-04-15 00:46:33 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP e77sm21399032pfk.147 - gsmtp
2018-04-15 00:46:33 CLIENT -> SERVER: EHLO localhost
2018-04-15 00:46:34 SMTP -> get_lines(): $data is ""
2018-04-15 00:46:34 SMTP -> get_lines(): $str is "250-smtp.gmail.com at your service, [113.166.92.87]"
2018-04-15 00:46:34 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [113.166.92.87]"
2018-04-15 00:46:34 SMTP -> get_lines(): $str is "250-SIZE 35882577"
2018-04-15 00:46:34 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [113.166.92.87]250-SIZE 35882577"
2018-04-15 00:46:34 SMTP -> get_lines(): $str is "250-8BITMIME"
2018-04-15 00:46:34 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [113.166.92.87]250-SIZE 35882577250-8BITMIME"
2018-04-15 00:46:34 SMTP -> get_lines(): $str is "250-STARTTLS"
2018-04-15 00:46:34 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [113.166.92.87]250-SIZE 35882577250-8BITMIME250-STARTTLS"
2018-04-15 00:46:34 SMTP -> get_lines(): $str is "250-ENHANCEDSTATUSCODES"
2018-04-15 00:46:34 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [113.166.92.87]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES"
2018-04-15 00:46:34 SMTP -> get_lines(): $str is "250-PIPELINING"
2018-04-15 00:46:34 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [113.166.92.87]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING"
2018-04-15 00:46:34 SMTP -> get_lines(): $str is "250-CHUNKING"
2018-04-15 00:46:34 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [113.166.92.87]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING"
2018-04-15 00:46:34 SMTP -> get_lines(): $str is "250 SMTPUTF8"
2018-04-15 00:46:34 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [113.166.92.87]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2018-04-15 00:46:34 CLIENT -> SERVER: STARTTLS
2018-04-15 00:46:34 SMTP -> get_lines(): $data is ""
2018-04-15 00:46:34 SMTP -> get_lines(): $str is "220 2.0.0 Ready to start TLS"
2018-04-15 00:46:34 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2018-04-15 00:46:34 CLIENT -> SERVER: EHLO localhost
2018-04-15 00:46:35 SMTP -> get_lines(): $data is ""
2018-04-15 00:46:35 SMTP -> get_lines(): $str is "250-smtp.gmail.com at your service, [113.166.92.87]"
2018-04-15 00:46:35 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [113.166.92.87]"
2018-04-15 00:46:35 SMTP -> get_lines(): $str is "250-SIZE 35882577"
2018-04-15 00:46:35 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [113.166.92.87]250-SIZE 35882577"
2018-04-15 00:46:35 SMTP -> get_lines(): $str is "250-8BITMIME"
2018-04-15 00:46:35 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [113.166.92.87]250-SIZE 35882577250-8BITMIME"
2018-04-15 00:46:35 SMTP -> get_lines(): $str is "250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH"
2018-04-15 00:46:35 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [113.166.92.87]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH"
2018-04-15 00:46:35 SMTP -> get_lines(): $str is "250-ENHANCEDSTATUSCODES"
2018-04-15 00:46:35 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [113.166.92.87]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES"
2018-04-15 00:46:35 SMTP -> get_lines(): $str is "250-PIPELINING"
2018-04-15 00:46:35 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [113.166.92.87]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING"
2018-04-15 00:46:35 SMTP -> get_lines(): $str is "250-CHUNKING"
2018-04-15 00:46:35 SMTP -> get_lines(): $data is "250-smtp.gmail.com at your service, [113.166.92.87]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING"
2018-04-15 00:46:35 SMTP -> get_lines(): $str is "250 SMTPUTF8"
2018-04-15 00:46:35 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [113.166.92.87]250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2018-04-15 00:46:35 Auth method requested: XOAUTH2
2018-04-15 00:46:35 Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH
2018-04-15 00:46:36 CLIENT -> SERVER: AUTH XOAUTH2 [somethingEncriptedHere]=
2018-04-15 00:46:36 SMTP -> get_lines(): $data is ""
2018-04-15 00:46:36 SMTP -> get_lines(): $str is "334 [somethingShorteEncriptedHere]=="
2018-04-15 00:46:36 SERVER -> CLIENT: 334 [somethingShorteEncriptedHere]==
2018-04-15 00:46:36 SMTP ERROR: AUTH command failed: 334 [somethingShorterEncriptedHere]==
SMTP Error: Could not authenticate.
2018-04-15 00:46:36 CLIENT -> SERVER: QUIT

It then tries to use Username and password but fails too.

Relevant part of the log is

2018-04-15 00:46:35 Auth method requested: XOAUTH2 //negotiates the method of authentication
2018-04-15 00:46:35 Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH //negotiates the method of authentication
2018-04-15 00:46:36 CLIENT -> SERVER: AUTH XOAUTH2 [somethingEncriptedHere]= //sends encrypted client secret(my guess)
2018-04-15 00:46:36 SMTP -> get_lines(): $data is ""
2018-04-15 00:46:36 SMTP -> get_lines(): $str is "334 [somethingShorterEncriptedHere]=="
2018-04-15 00:46:36 SERVER -> CLIENT: 334 [somethingShorterEncriptedHere]==
2018-04-15 00:46:36 SMTP ERROR: AUTH command failed: 334 [somethingShorterEncriptedHere]== //fails SMTP Error: Could not authenticate.
2018-04-15 00:46:36 CLIENT -> SERVER: QUIT

I am not sure why does it fail on authentication if it already has successfully connected/registered the Gmail plugin with gmail?

Upvotes: 1

Views: 7442

Answers (2)

s7ihL
s7ihL

Reputation: 87

First you can check the API and you can check this in another web-server. Did you give permission google API for your own web-site? If anything is not working fine, maybe you have to check your plugin version.

Upvotes: 0

Matas Vaitkevicius
Matas Vaitkevicius

Reputation: 61351

Figured out myself

It would appear that email has to be one that I have connected web application to ([email protected]), not the one that looks like [email protected]

In other words you will be able to connect plugin to gmail API with incorrect email, but it will fail at sending emails later.

Upvotes: 1

Related Questions