Message Generation with Date and Message-ID : Email : Network PYTHON TUTORIALS


PYTHON TUTORIALS » Network » Email »

 

Message Generation with Date and Message-ID


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

msg = MIMEText(message)
msg['To'] 'recipient@example.com'
msg['From'] 'Test Sender <sender@example.com>'
msg['Subject'] '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