import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

username = "cheung@emory.edu"
password = "Beta0123."
mail_from = "cheung@emory.edu"
mail_to = "cheung@emory.edu"
mail_subject = "Python email"
mail_body = "This message was sent with Python."

mimemsg = MIMEMultipart()
mimemsg['From']=mail_from
mimemsg['To']=mail_to
mimemsg['Subject']=mail_subject
mimemsg.attach(MIMEText(mail_body, 'plain'))
connection = smtplib.SMTP(host='smtp.office365.com', port=587)
connection.starttls()
connection.login(username,password)
connection.send_message(mimemsg)
connection.quit()
