Search code examples
smtpgmail

GMail AUTH LOGIN SMTP Authentication


I'm trying to authenticate myself against GMail SMTP Server by using the LOGIN authentication mechanism. AUTH LOGIN is advertised as supported in the response to the EHLO command, but when I'm trying to send AUTH LOGIN to the server, I'm getting "504 5.7.4 Unrecognized Authentication Type" response. Here is the dialog between the server and the client:

S: 220 mx.google.com ESMTP d9sm13589149wiy.2
C: EHLO client
S: 250-mx.google.com at your service, [x.x.x.x]
S: 250-SIZE 35882577
S: 250-8BITMIME
S: 250-AUTH LOGIN PLAIN XOAUTH
s: 250 ENHANCEDSTATUSCODES
C: AUTH LOGIN
S: 504 5.7.4 Unrecognized Authentication Type d9sm13589149wiy.2

Am I doing something wrong here?


Solution

  • What I've found out is that once I'm using "AUTH LOGIN base64username", which is not really how LOGIN should be working, it actually seems to work:

    S: 220 mx.google.com ESMTP n3sm42168657wiz.9
    C: EHLO client
    S: 250-mx.google.com at your service, [x.x.x.x]
    S: 250-SIZE 35882577
    S: 250-8BITMIME
    S: 250-AUTH LOGIN PLAIN XOAUTH
    S: 250 ENHANCEDSTATUSCODES
    C: AUTH LOGIN base64username
    S: 334 UGFzc3dvcmQ6
    C: base64password
    S: 235 2.7.0 Accepted