email.generator.BytesGenerator

class email.generator.BytesGenerator(outfp, mangle_from_=True, maxheaderlen=78, *, policy=None) The constructor for the BytesGenerator class takes a binary file-like object called outfp for an argument. outfp must support a write() method that accepts binary data. Optional mangle_from_ is a flag that, when True, puts a > character in front of any line in the body that starts exactly as From, i.e. From followed by a space at the beginning of the line. This is the only guaranteed portable w

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.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.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.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_noop()

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

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_7or8bit()

email.encoders.encode_7or8bit(msg) This doesn’t actually modify the message’s payload, but it does set the Content-Transfer-Encoding header to either 7bit or 8bit as appropriate, based on the payload data.