email.generator.BytesGenerator.flatten()

flatten(msg, unixfrom=False, linesep=None) Print the textual representation of the message object structure rooted at msg to the output file specified when the BytesGenerator instance was created. Subparts are visited depth-first and the resulting text will be properly MIME encoded. If the policy option cte_type is 8bit (the default), then any bytes with the high bit set in the original parsed message that have not been modified will be copied faithfully to the output. If cte_type is 7bit, t

email.errors.MultipartConversionError

exception email.errors.MultipartConversionError Raised when a payload is added to a Message object using add_payload(), but the payload is already a scalar and the message’s Content-Type main type is not either multipart or missing. MultipartConversionError multiply inherits from MessageError and the built-in TypeError. Since Message.add_payload() is deprecated, this exception is rarely raised in practice. However the exception may also be raised if the attach() method is called on an instan

email.errors.MessageParseError

exception email.errors.MessageParseError This is the base class for exceptions raised by the Parser class. It is derived from MessageError.

email.errors.HeaderParseError

exception email.errors.HeaderParseError Raised under some error conditions when parsing the RFC 2822 headers of a message, this class is derived from MessageParseError. It can be raised from the Parser.parse or Parser.parsestr methods. Situations where it can be raised include finding an envelope header after the first RFC 2822 header of the message, finding a continuation line before the first RFC 2822 header is found, or finding a line in the headers which is neither a header or a continua

email.errors.MessageError

exception email.errors.MessageError This is the base class for all exceptions that the email package can raise. It is derived from the standard Exception class and defines no additional methods.

email.errors.BoundaryError

exception email.errors.BoundaryError Raised under some error conditions when parsing the RFC 2822 headers of a message, this class is derived from MessageParseError. It can be raised from the Parser.parse or Parser.parsestr methods. Situations where it can be raised include not being able to find the starting or terminating boundary in a multipart/* message when strict parsing is used.

email.encoders.encode_quopri()

email.encoders.encode_quopri(msg) Encodes the payload into quoted-printable form and sets the Content-Transfer-Encoding header to quoted-printable [1]. This is a good encoding to use when most of your payload is normal printable data, but contains a few unprintable characters.

email.encoders.encode_base64()

email.encoders.encode_base64(msg) Encodes the payload into base64 form and sets the Content-Transfer-Encoding header to base64. This is a good encoding to use when most of your payload is unprintable data since it is a more compact form than quoted-printable. The drawback of base64 encoding is that it renders the text non-human readable.

email.encoders.encode_noop()

email.encoders.encode_noop(msg) This does nothing; it doesn’t even set the Content-Transfer-Encoding header.

email.contentmanager.get_content()

email.contentmanager.get_content(msg, errors='replace') Return the payload of the part as either a string (for text parts), an EmailMessage object (for message/rfc822 parts), or a bytes object (for all other non-multipart types). Raise a KeyError if called on a multipart. If the part is a text part and errors is specified, use it as the error handler when decoding the payload to unicode. The default error handler is replace.