python MIME Multipart Messages
#!/usr/bin/python from email.MIMEMultipart import MIMEMultipart import os import sys filename = sys.argv[1] msg = MIMEMultipart() msg['From'] = 'Me <me@example.com>' msg['To'] = 'You <you@example.com>' msg['Subject'] = 'Your picture' from email.MIMEText import MIMEText text = MIMEText("Here's that picture I took of you.") msg.attach(text) from email.MIMEImage import MIMEImage image = MIMEImage(open(filename).read(), name=os.path.split(filename)[1]) msg.attach(image)