For some reason, I cannot send an email from my application using Google SMTP protocol. I receive a message that looks like that:
1. Unhandled javax.mail.AuthenticationFailedException
534-5.7.14
<https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbt0
534-5.7.14
joZVenRyJq1oMRdChfymgOOgcAmikBwqT-_rFkNsHtvsquevNauUwW34Ksg5n8kXxPTALF
534-5.7.14
SYbdpH4O4GEE2TXaQmHScXAY15r_00D-lmyVzoJs54ba6RrOYb-yVcFNpsZbxxonQckTgd
534-5.7.14
dxdnp69p7t3_xj5523el2LWvh_HPE2lKTgOr8yLkeXjrFKYhvJT1jRhb5-Sy3Rs3G7OjuS
534-5.7.14 GdcriEyrrStn9Re4Vq7U46c5f8SwM> Please log in via your
web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more
at 534 5.7.14 https://support.google.com/mail/answer/78754
c12-v6sm1390727lji.59 - gsmtp
Some facts:
- The web interface (gmail.com) works fine;
- I've got 2FA enabled;
- I use a new application password;
- IMAP is enabled in gmail settings, I checked it;
- Another account with 2FA and application password works fine in my app.
- Both accounts are in different Google custom domains. May it affect them somehow?
Code (I use Clojure):
(def cred {:host "imap.gmail.com"
:user "user@my_domain.net"
:pass "application_password"
:ssl true})
(send-message cred {:from "test@test.com"
:to "bar@test.me"
:subject "hello"
:body "test"})
UPD: I also tried to follow the link from the response. It prompts me for 2FA and then redirects me to my account settings. Sending an email still doesn't work.