无法连接到受2FA保护的Gmail SMTP [英] Can't connect to Gmail SMTP secured with 2FA

查看:102
本文介绍了无法连接到受2FA保护的Gmail SMTP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某些原因,我无法使用Google SMTP协议从应用程序发送电子邮件.我收到一条看起来像这样的消息:

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

一些事实:

  • Web界面(gmail.com)工作正常;
  • 我启用了2FA;
  • 我使用了新的应用程序密码;
  • 我在gmail设置中启用了IMAP,我检查了它;
  • 另一个具有2FA和应用程序密码的帐户在我的应用程序中可以正常工作.
  • 两个帐户都位于不同的Google自定义域中.会以某种方式影响他们吗?

代码(我使用Clojure):

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:我还尝试遵循响应中的链接.它提示我输入2FA,然后将我重定向到我的帐户设置.仍然无法发送电子邮件.

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.

推荐答案

尝试了8个小时之后,我在Google Apps中找到了一个选项.转到安全性->高级->选中允许用户管理其安全设置"(已禁用).现在可以了,天哪.

After 8 hours of trying this and that I found an option in Google Apps. Go to Security -> Advanced -> Check "Allow users to manage their security settings" (it was disabled). Now it works, oh gosh.

这篇关于无法连接到受2FA保护的Gmail SMTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆