for content_type in masks:
if content_type in g.save_headers_mask:
_save_message(msg, outstring, save_headers=True, save_body=False)
- elif content_type in g.save_body_mask:
+ if content_type in g.save_body_mask:
_save_message(msg, outstring, save_headers=False, save_body=True)
- elif content_type in g.save_message_mask:
+ if content_type in g.save_message_mask:
_save_message(msg, outstring, save_headers=True, save_body=True)
for content_type in masks:
"Decode multipart"
decode_headers(msg)
+ boundary = msg.get_boundary()
+
+ masks = []
+ ctype = msg.get_content_type()
+ if ctype:
+ masks.append(ctype)
+ mtype = ctype.split('/')[0]
+ masks.append(mtype + '/*')
+ masks.append('*/*')
+
+ for content_type in masks:
+ if content_type in g.ignore_mask:
+ output_headers(msg)
+ output("%sMessage body of type %s skipped.%s" % (os.linesep, ctype, os.linesep))
+ if boundary:
+ output("%s--%s--%s" % (os.linesep, boundary, os.linesep))
+ return
+ elif content_type in g.error_mask:
+ raise ValueError, "content type %s prohibited" % ctype
+
output_headers(msg)
if msg.preamble: # Preserve the first part, it is probably not a RFC822-message
output(os.linesep)
first_subpart = True
- boundary = msg.get_boundary()
-
for subpart in msg.get_payload():
if boundary:
if first_subpart: