我正在try 使用python发送邮箱.在谷歌禁用"不太安全的应用程序"之前,我的代码运行良好.我的邮箱地址和密码都正确.
server = smtplib.SMTP_SSL("smtp.gmail.com", 465)
serverEmail = "EMAILADDRESS"
serverPw = "QWERTY"
server.login(serverEmail, serverPw)
subject = "Rejection"
body = "Hi! You've been unfortunately declined access to our system."
message = f'Subject: {subject}\n\n{body}'
server.sendmail("EMAILADDRESS", doctorEmail['email'], message)
server.quit()
我现在收到此错误:
smtplib.SMTPAuthenticationError:(535,b'5.7.8用户名和密码不接受.
我在使用server.starttls()
时出现此错误:
smtplib.SMTPNotSupportedError:服务器不支持STARTTLS扩展.