How to send an email in Python Language?
To send an email, Python provides smtplib and email modules. Import these modules into the created mail script and send mail by authenticating a user.
It has a method SMTP(smtp-server, port). It requires two parameters to establish SMTP connection.
A simple example to send an email is given below.
# Calling SMTP
s = smtplib.SMTP('smtp.gmail.com', 587)
# TLS for network security
# User email Authentication
# message to be sent
message = "Message_you_need_to_send"
# sending the mail
s.sendmail("sender_email_id", "receiver_email_id", message)
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.