MIME message generation with 8-bit headers : Email : Network PYTHON TUTORIALS


PYTHON TUTORIALS » Network » Email »

 

MIME message generation with 8-bit headers


from email.MIMEText import MIMEText
from email.Header import Header
from email import Utils
message = """Hello,
This is a test messaget!
-- Anonymous"""

msg = MIMEText(message)
msg['To'] 'recipient@example.com'
fromhdr = Header("Michael Mxfcller"'iso-8859-1')
fromhdr.append('<mmueller@example.com>', 'ascii')
msg['From'] = fromhdr
msg['Subject'] = Header('Test Message')
msg['Date'] = Utils.formatdate(localtime = 1)
msg['Message-ID'] = Utils.make_msgid()

print msg.as_string()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Network
» Email