没有谷歌smtp,还有没有其他方法可以谷歌登录?

2024-04-20 11:37:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个烧瓶应用程序,它将发送电子邮件给用户谁将注册他们的电子邮件。我已经写了下面的代码,并打开gmail账户中不太安全的应用程序

import smtplib
def send_email():
    server = smtplib.SMTP('smtp.gmail.com',587)
    server.ehlo()
    server.starttls()
    server.ehlo()
    server.login('Sender's mail id', 'Sender's mail password')
    message = 'sending this from python!'
    server.sendmail('Sender's mail id', 'Receiver's mail id', message)
    server.quit()

send_email()

当调用send_email()时,我得到了以下错误

smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials z10sm10066531pfa.184 - gsmtp')

后来我发现,虽然我打开了访问不太安全的应用程序,但它在内部仍处于关闭状态,在重新加载设置的一段时间后,它的显示也关闭了

请帮帮我,我的项目被卡住了


Tags: 用户comsendid应用程序messageserver烧瓶