totext(msg, outstring)
-def decode_message(msg):
- "Decode message"
+def decode_multipart(msg):
+ "Decode multipart"
if msg.is_multipart():
decode_headers(msg)
if boundary:
output("\n--%s\n" % boundary)
- if subpart.is_multipart(): # Recursively decode all parts of the subpart
- decode_message(subpart)
- else:
- decode_part(subpart)
+ # Recursively decode all parts of the subpart
+ decode_message(subpart)
if boundary:
output("\n--%s--\n" % boundary)
if msg.epilogue:
output(msg.epilogue)
- else:
- if msg.has_key("Content-Type"): # Simple one-part message - decode it
- decode_part(msg)
+def decode_message(msg):
+ "Decode message"
- else: # Not a message, just text - copy it literally
- output(msg.as_string())
+ if msg.is_multipart():
+ decode_multipart(msg)
+ elif msg.has_key("Content-Type"): # Simple one-part message - decode it
+ decode_part(msg)
+ else: # Not a message, just text - copy it literally
+ output(msg.as_string())
class GlobalOptions: