port = 465 # For SSL
smtp_server = "smtp.mail.yahoo.com"
sender_email = "c.junction@yahoo.com" # Enter your address
password = input("Type your password and press enter:")
receiver_email = "jawoneb660@jobsfeel.com" # Enter receiver address
Subject = "Hi there"
message = """Hello World!!!
This message is sent from Python."""
context = ssl.create_default_context()
with smtplib.SMTP_SSL(smtp_server, port, context=context) as smtp:
smtp.login(sender_email, password)
smtp.sendmail(sender_email, receiver_email, Subject, message)
我试着检查是否有任何认证失败。电子邮件无法发送。我得到以下错误消息。
引发SMTPServer断开连接(“连接意外关闭”)smtplib。SMTPServer断开连接:连接意外关闭'
1条答案
按热度按时间lhcgjxsq1#
我没有看到它列在这里,但是你导入smtplib和ssl模块了吗?