使用 smptlib 登录我的 gmail 帐户时出现身份验证错误

Posted

技术标签:

【中文标题】使用 smptlib 登录我的 gmail 帐户时出现身份验证错误【英文标题】:I am getting Authentication Error while logging in to my gmail account using smptlib 【发布时间】:2019-01-16 13:19:03 【问题描述】:

我已经启用了我的 POP 和 IMAP,但在登录到 gmail 帐户时仍然抛出错误...这是我的代码

import smtplib
host="smtp.gmail.com"
port=587
username="bilalgcu29@gmail.com"
password="xyz"
connection = smtplib.SMTP(host,port)
connection.ehlo()
connection.starttls()
connection.login(username,password)

错误是引发 SMTPAuthenticationError(code, resp) smtplib.SMTPAuthenticationError: (534, b'5.7.14 ....)

【问题讨论】:

How to send an email with Gmail as provider using Python?的可能重复 【参考方案1】:

我通过访问此链接得到答案并将其打开 https://www.google.com/settings/security/lesssecureapps

【讨论】:

以上是关于使用 smptlib 登录我的 gmail 帐户时出现身份验证错误的主要内容,如果未能解决你的问题,请参考以下文章

gmail帐户如何存储其他网站的密码

在Google Cloud Platform上为其他帐户创建SSH密钥

heroku cli登录显示错误的帐户信息

Gmail API 多个帐户

使用 Facebook、Twitter 或 GMail 登录我的应用

让 nodemailer 使用不同的 gmail 帐户发送电子邮件