我想从python脚本发送一封电子邮件。但是,当我尝试运行server.login时,收到以下错误:smtplib.SMTPAuthenticationError: (535, '5.7.0 (#MBR1212) Incorrect username or password.')
我已经用Gmail和雅虎的账号试过了。Gmail错误是:
smtplib.SMTPAuthenticationError: (535, '5.7.8 Username and Password not accepted. Learn more at\n5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 u2sm21203448pbs.42 \
- gsmtp')雅虎的错误是
smtplib.SMTPAuthenticationError: (535, '5.7.0 (#MBR1212) Incorrect username or password.')我使用的代码如下所示。用户名和密码是代表我正确的用户名和密码的字符串变量。
server = smtplib.SMTP('smtp.mail.yahoo.com', 587)
server.ehlo()
server.starttls()
server.login(username, password)我正在使用Python 2.7.6 |Anaconda 1.8.0 (x86_64)| (default, May 27 2014, 14:58:54)
发布于 2016-10-27 19:31:31
你应该去雅虎电子邮件帐户,然后去Account security和active Allow apps that use less secure sign in来解决你的问题。
https://stackoverflow.com/questions/25024565
复制相似问题