Sorry to revive such an old question, but it's still coming up in the search results for this issue.
What I have discovered, is that Google is now doing full "Device Management", so from every device that you want to login from you'll have to visit:
https://accounts.google.com/DisplayUnlockCaptcha
The problem is that I don't have X11 setup on my exim4 server, and I can't figure out the magic CURL formula to go to the link and pull the token that is dynamically generated when you press the "Continue" button on that URL.
Because of this, even when I have configured TLS/mta support in exim4 (SSH/smtps is no longer supported by Google), to connect to smtp.google.com:587 it will not accept my username/password without going to:
https://myaccount.google.com/lesssecureapps?utm_source=google-account&utm_medium=web
to enable access by "less secure app".
I even tested this manually via:
openssl s_client -starttls smtp -connect smtp.gmail.com:587 -crlf
Issuing:
EHLO {servername}
AUTH PLAIN {base64 encoded combo username password string}
Every time I get the error:
535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials l22sm5213582ywl.68 - gsmtp
You get the base64 encoded string with the command:
echo -ne "\0{login_email}\0{login_password}"|base64
Once I set the "enable less secure apps" the exact example above returns:
235 2.7.0 Accepted
And, exim4 likewise starts working.
Can anyone recommend a CLI way to access the captcha link?
exim
. The relevant file, in Debian, at least, is/etc/exim4/passwd.client
.