SMTPAuthenticationError:(535,' 5.0.0身份验证失败')

时间:2016-01-30 08:47:14

标签: python python-2.7 smt smtp-auth

我正在运行一个python代码,用于从我的Hotmail帐户发送电子邮件。我正在使用的代码是:

def initmail():
    signin()
    ##if "gmail" in username:
    ##    server = smtplib.SMTP('smtp.gmail.com', 587)
    ##if "hotmail" in username:
    server = smtplib.SMTP('smtp.live.com', 587)
    server.starttls()
    server.login(username, password)
    messenger()
    msg = MIMEMultipart()
    msg['From'] = username
    msg['To'] = mailto
    msg['Subject'] = subject

    body = bodytext
    msg.attach(MIMEText(body, 'plain'))

    text = msg.as_string()
    server.sendmail(username, mailto, text)
    server.quit()

用户在登录功能中输入电子邮件地址和密码。但是我收到以下错误:

enter image description here

为什么代码会产生此错误?

0 个答案:

没有答案
相关问题