Mar-27-2019, 03:51 PM
In lines 13 and 14 what exactly does context mean? Why do we need to use it?
import smtplib, ssl port = 465 # For SSL smtp_server = "smtp.gmail.com" sender_email = "[email protected]" # Enter your address receiver_email = "[email protected]" # Enter receiver address password = input("Type your password and press enter: ") message = """\ Subject: Hi there This message is sent from Python.""" context = ssl.create_default_context() with smtplib.SMTP_SSL(smtp_server, port, context=context) as server: server.login(sender_email, password) server.sendmail(sender_email, receiver_email, message)