##Adapted from http://stackoverflow.com/questions/882712/sending-html-email-using-python## import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText username = "enter your gmail username" pwd = "enter your gmail password" me = "enter a sender email address" you = "enter a recipient email address" def sendHTMLmsg(subject, URL, link_text): # Create message container - the correct MIME type is multipart/alternative. msg = MIMEMultipart('alternative') msg['Subject'] = subject msg['From'] = me msg['To'] = you # Body of HTML message (your article link) body = "
"+link_text+"" # Set MIME type of body string to text/html. html = MIMEText(body, 'html') # Attach to message container. msg.attach(html) # Send the message via local SMTP server. mail = smtplib.SMTP('smtp.gmail.com', 587) mail.starttls() mail.login(username, pwd) mail.sendmail(me, you, msg.as_string()) mail.quit()