import smtplib
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
smtp_sever = smtplib.SMTP('smtp_host')
msgRoot = MIMEMultipart('related')
msg['From'] = sender
msg['To'] = recepient
msg['Subject'] = 'Hello'
msgAlernative = MIMEMultipart('alernative')
msgRoot.attach(msgAlernative)
html="<html><body>Hello world</body></html>
msgHtml = MIMEText(html, 'html')
msgAlernative.attach(msgHtml)
text = 'Hello world'
msgTxt = MIMEText(text)
msgAlernative.attach(msgTxt)
smtp_server.sendmail(sender, recepient, msgRoot.as_string())