【问题标题】:I can't send emails with python我无法用 python 发送电子邮件
【发布时间】:2021-11-01 20:19:42
【问题描述】:
from mailer import Mailer
mail = Mailer(email='my email', password='my password')

mail.send(receiver='random email', subject="test", message="Cool reset")

当我运行它时,我得到一个错误,它说

错误:不接受电子邮件和密码。

注意: 确保您允许不太安全的应用程序, 如果没有,请访问此链接: ==> https://myaccount.google.com/lesssecureapps

For More information visit this link:
==> https://support.google.com/mail/?p=BadCredentials

我已经将“允许不太安全的应用程序”设置为开启。

顺便说一句,电子邮件凭据不是我在代码中使用的实际凭据

【问题讨论】:

标签: python gmail


【解决方案1】:

以下内容适用于我自己的凭据,您只需将大括号替换为您的数据(例如:mail = Mailer("email", "password")):

from mailer import Mailer

mail = Mailer("{sender_email}", "{sender_password}")
mail.send(receiver="{receiver_email}", subject="{subject}", message={"message"})

我发现了这个documentation for quick-mailer。也许问题是使用单引号,也许尝试只使用双引号?

用那个信息再试一次,祝你好运。

【讨论】:

    猜你喜欢
    • 2016-06-21
    • 2016-04-09
    • 2015-08-19
    • 1970-01-01
    • 2018-11-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-22
    相关资源
    最近更新 更多