Add option -B to skip content-transfer-decoding binary attachments.
+ Fix a minor bug: if a multipart message (or a subpart) lacks any textual
+content - avoid putting an excessive newline.
+
WHAT'S NEW in version 2.4.0 (2014-03-08)
Change option -d to accept a comma-separated list of headers:
if msg.preamble: # Preserve the first part, it is probably not a RFC822-message
output(msg.preamble) # Usually it is just a few lines of text (MIME warning)
+ if msg.preamble is not None:
+ output("\n")
+ first_subpart = True
boundary = msg.get_boundary()
for subpart in msg.get_payload():
if boundary:
- output("\n--%s\n" % boundary)
+ if first_subpart:
+ first_subpart = False
+ else:
+ output("\n")
+ output("--%s\n" % boundary)
# Recursively decode all parts of the subpart
decode_message(subpart)
Content-Type: multipart/mixed; boundary="192.168.1.2.889.32614.987812255.500.21814"
X-Mailer: Mailman v2.0.4; test="set"
-
--192.168.1.2.889.32614.987812255.500.21814
Content-description: Masthead (Ppp digest, Vol 1 #2)
MIME-Version: 1.0
--192.168.1.2.889.32614.987812255.500.21814
Content-Type: multipart/digest; boundary="__--__--"
-
--__--__--
Message: 1
X-Mailman-Version: 2.0.4
Content-Type: multipart/mixed; boundary="192.168.1.2.889.32614.987812255.500.21814"
-
--192.168.1.2.889.32614.987812255.500.21814
Content-description: Masthead (Ppp digest, Vol 1 #2)
MIME-Version: 1.0
--192.168.1.2.889.32614.987812255.500.21814
Content-Type: multipart/digest; boundary="__--__--"
-
--__--__--
Message: 1
Date: Fri, 20 Apr 2001 19:35:02 -0400
Content-Type: multipart/mixed; boundary="BOUNDARY"
-
--BOUNDARY
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Date: Fri, 20 Apr 2001 19:35:02 -0400
Content-Type: multipart/mixed; boundary="BOUNDARY"
-
--BOUNDARY
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Date: Fri, 20 Apr 2001 19:35:02 -0400
Content-Type: multipart/mixed; boundary="BOUNDARY"
-
--BOUNDARY
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
Date: Fri, 20 Apr 2001 19:35:02 -0400
Content-Type: multipart/mixed; boundary="BOUNDARY"
-
--BOUNDARY
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
--BOUNDARY
Content-Type: multipart/mixed; boundary="ANOTHER"
-
--ANOTHER
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Date: Fri, 20 Apr 2001 19:35:02 -0400
Content-Type: multipart/mixed; boundary="BOUNDARY"
-
--BOUNDARY
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
--BOUNDARY
Content-Type: multipart/mixed; boundary="ANOTHER"
-
--ANOTHER
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Date: Fri, 20 Apr 2001 19:35:02 -0400
Content-Type: multipart/mixed; boundary="OUTER"
-
--OUTER
Content-Type: text/plain; charset="us-ascii"
From: aperson@dom.ain
Content-Type: multipart/mixed; boundary="BOUNDARY"
-
--BOUNDARY
Content-Type: text/plain
To: aperson@dom.ain
From: bperson@dom.ain
-
--BOUNDARY
MIME-Version: 1.0
Content-Type: multipart/digest; boundary=BOUNDARY
-
--BOUNDARY
Content-Type: message/rfc822
MIME-Version: 1.0
Content-Type: multipart/digest; boundary=BOUNDARY
-
--BOUNDARY
To: aa@bb.org
To: bperson@dom.ain
Content-Type: multipart/digest; boundary=XYZ
-
--XYZ
Content-Type: text/plain
Subject: I-D ACTION:draft-ietf-mboned-mix-00.txt
Date: Tue, 22 Dec 1998 16:55:06 -0500
-
--NextPart
Blah blah blah
--NextPart
Content-Type: Multipart/Alternative; Boundary="OtherAccess"
-
--OtherAccess
Content-Type: Message/External-body;
access-type="mail-server";
From test Sat Feb 1 00:00:00 2014
Content-Type: multipart/mixed; boundary=ABCDE
-
--ABCDE
Content-Type: text/x-one
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
-
------- =_aaaaaaaaaa0
Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa1"
Content-ID: <20592.1022586929.1@example.com>
-
------- =_aaaaaaaaaa1
Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa2"
Content-ID: <20592.1022586929.2@example.com>
-
------- =_aaaaaaaaaa2
Content-Type: text/plain
Content-ID: <20592.1022586929.3@example.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
-
------- =_aaaaaaaaaa0
Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa1"
Content-ID: <20592.1022586929.1@example.com>
-
------- =_aaaaaaaaaa1
Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa1"
Content-ID: <20592.1022586929.2@example.com>