Here are some notes on the parsing semantics:
- Most non-multipart type messages are parsed as a single
message object with a string payload. These objects will return
False
for is_multipart(). Their
get_payload() method will return a string object.
- All multipart type messages will be parsed as a
container message object with a list of sub-message objects for
their payload. The outer container message will return
True
for is_multipart() and their
get_payload() method will return the list of
Message subparts.
- Most messages with a content type of message/*
(e.g. message/delivery-status and
message/rfc822) will also be parsed as container
object containing a list payload of length 1. Their
is_multipart() method will return
True
. The
single element in the list payload will be a sub-message object.
- Some non-standards compliant messages may not be internally consistent
about their multipart-edness. Such messages may have a
header of type multipart, but their
is_multipart() method may return
False
. If such
messages were parsed with the FeedParser, they will have an
instance of the MultipartInvariantViolationDefect class in their
defects attribute list. See email.errors for
details.
Release 2.5.4, documentation updated on 23rd December, 2008.
See About this document... for information on suggesting changes.