email.utils.decode_rfc2231()

email.utils.decode_rfc2231(s) Decode the string s according to RFC 2231.

email.utils.decode_params()

email.utils.decode_params(params) Decode parameters list according to RFC 2231. params is a sequence of 2-tuples containing elements of the form (content-type, string-value).

email.utils.collapse_rfc2231_value()

email.utils.collapse_rfc2231_value(value, errors='replace', fallback_charset='us-ascii') When a header parameter is encoded in RFC 2231 format, Message.get_param may return a 3-tuple containing the character set, language, and value. collapse_rfc2231_value() turns this into a unicode string. Optional errors is passed to the errors argument of str‘s encode() method; it defaults to 'replace'. Optional fallback_charset specifies the character set to use if the one in the RFC 2231 header is not

email.policy.strict

email.policy.strict Convenience instance. The same as default except that raise_on_defect is set to True. This allows any policy to be made strict by writing: somepolicy + policy.strict

email.policy.Policy.register_defect()

register_defect(obj, defect) Register a defect on obj. In the email package, defect will always be a subclass of Defect. The default implementation calls the append method of the defects attribute of obj. When the email package calls handle_defect, obj will normally have a defects attribute that has an append method. Custom object types used with the email package (for example, custom Message objects) should also provide such an attribute, otherwise defects in parsed messages will raise unex

email.policy.Policy.raise_on_defect

raise_on_defect If True, any defects encountered will be raised as errors. If False (the default), defects will be passed to the register_defect() method.

email.policy.Policy.max_line_length

max_line_length The maximum length of any line in the serialized output, not counting the end of line character(s). Default is 78, per RFC 5322. A value of 0 or None indicates that no line wrapping should be done at all.

email.policy.Policy.mangle_from_

mangle_from_ If True, lines starting with “From “ in the body are escaped by putting a > in front of them. This parameter is used when the message is being serialized by a generator. Default: False. New in version 3.5: The mangle_from_ parameter.

email.policy.Policy.linesep

linesep The string to be used to terminate lines in serialized output. The default is \n because that’s the internal end-of-line discipline used by Python, though \r\n is required by the RFCs.

email.policy.Policy.header_store_parse()

header_store_parse(name, value) The email package calls this method with the name and value provided by the application program when the application program is modifying a Message programmatically (as opposed to a Message created by a parser). The method should return the (name, value) tuple that is to be stored in the Message to represent the header. If an implementation wishes to retain compatibility with the existing email package policies, the name and value should be strings or string s