email.message.EmailMessage.add_alternative()

add_alternative(*args, content_manager=None, **kw) If the message is a multipart/alternative, create a new message object, pass all of the arguments to its set_content() method, and attach() it to the multipart. If the message is a non-multipart or multipart/related, call make_alternative() and then proceed as above. If the message is any other type of multipart, raise a TypeError. If content_manager is not specified, use the content_manager specified by the current policy.

email.iterators._structure()

email.iterators._structure(msg, fp=None, level=0, include_default=False) Prints an indented representation of the content types of the message object structure. For example: >>> msg = email.message_from_file(somefile) >>> _structure(msg) multipart/mixed text/plain text/plain multipart/digest message/rfc822 text/plain message/rfc822 text/plain message/rfc822 text/plain message/rfc822

email.iterators.typed_subpart_iterator()

email.iterators.typed_subpart_iterator(msg, maintype='text', subtype=None) This iterates over all the subparts of msg, returning only those subparts that match the MIME type specified by maintype and subtype. Note that subtype is optional; if omitted, then subpart MIME type matching is done only with the main type. maintype is optional too; it defaults to text. Thus, by default typed_subpart_iterator() returns each subpart that has a MIME type of text/*.

email.headerregistry.SingleAddressHeader

class email.headerregistry.SingleAddressHeader A subclass of AddressHeader that adds one additional attribute: address The single address encoded by the header value. If the header value actually contains more than one address (which would be a violation of the RFC under the default policy), accessing this attribute will result in a ValueError.

email.headerregistry.SingleAddressHeader.address

address The single address encoded by the header value. If the header value actually contains more than one address (which would be a violation of the RFC under the default policy), accessing this attribute will result in a ValueError.

email.iterators.body_line_iterator()

email.iterators.body_line_iterator(msg, decode=False) This iterates over all the payloads in all the subparts of msg, returning the string payloads line-by-line. It skips over all the subpart headers, and it skips over any subpart with a payload that isn’t a Python string. This is somewhat equivalent to reading the flat text representation of the message from a file using readline(), skipping over all the intervening headers. Optional decode is passed through to Message.get_payload.

email.headerregistry.UnstructuredHeader

class email.headerregistry.UnstructuredHeader An “unstructured” header is the default type of header in RFC 5322. Any header that does not have a specified syntax is treated as unstructured. The classic example of an unstructured header is the Subject header. In RFC 5322, an unstructured header is a run of arbitrary text in the ASCII character set. RFC 2047, however, has an RFC 5322 compatible mechanism for encoding non-ASCII text as ASCII characters within a header value. When a value conta

email.headerregistry.MIMEVersionHeader.minor

minor The minor version number as an integer

email.headerregistry.MIMEVersionHeader

class email.headerregistry.MIMEVersionHeader There is really only one valid value for the MIME-Version header, and that is 1.0. For future proofing, this header class supports other valid version numbers. If a version number has a valid value per RFC 2045, then the header object will have non-None values for the following attributes: version The version number as a string, with any whitespace and/or comments removed. major The major version number as an integer minor The minor

email.headerregistry.MIMEVersionHeader.major

major The major version number as an integer