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)
I tried checking if there is any auth failure.Email could not be sent. I got following error msg.
raise SMTPServerDisconnected("Connection unexpectedly closed") smtplib.SMTPServerDisconnected: Connection unexpectedly closed`