| | | MIME Multipart Messages |
|
|
#!/usr/bin/python
from email.MIMEMultipart import MIMEMultipart
import os
import sys
filename = sys.argv[1]
msg = MIMEMultipart()
msg['From'] = 'Me <[email protected]>'
msg['To'] = 'You <[email protected]>'
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)
|
|
|
|
| Related examples in the same category |
|