
Untitled
By: a guest on
Apr 28th, 2012 | syntax:
None | size: 0.94 KB | hits: 13 | expires: Never
modifying multipart headers when using the email library in python
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultiPart
msg = MIMEMultipart('alternative')
text = 'add this text to the multipart'
textMIME = MIMEText(text, 'plain')
msg.attach(MIMEText)
text2 = 'add this text to the next multipart'
text2MIME = MIMEText(text2, 'plain')
msg.attach(MIME2Text)
Return-Path: xxxxx
X-Original-To: xxxxxxxxx
Delivered-To: xxxxxxx
Received: from xxxxxx
to xxxxxxxxx
for xxxxxxxxx
Content-Type: multipart/alternative;
boundary="==========yyyyyyyy=="
MIME-Version: 1.0
Message-Id: xxxxxxx
Date: xxxxxx
From: xxxxx
To: xxxxx
--==========yyyyyyyy==
Content-Type: xxxxxxx
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
add this text to the multipart
--==========yyyyyyyy==
Content-Type: xxxxxxx
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
add this text to the next multipart
--==========yyyyyyyy==