# smtplib helps in sending emails
import smtplib
# This is SMTP server details of Gmail, to create SMTP session
server = smtplib.SMTP('smtp.gmail.com', 587)
# Start TLS for security
server.starttls()
# Provide your username and password of gmail account
server.login("your.emailId@gmail.com", "YourPassWord")
# Provide your message body (email body) that you want to send
msg = "HI!"
server.sendmail("your.emailId@gmail.com", "To.EmailID@gmail.com", msg)
server.quit()
If you want to send an email with Subject, you need to change msg details as follows
msg = 'Subject:{}\n\n{}'.format("this is subject", "this is body")
Comment here