email.policy.default

email.policy.default An instance of EmailPolicy with all defaults unchanged. This policy uses the standard Python \n line endings rather than the RFC-correct \r\n.

email.policy.Compat32.mangle_from_

mangle_from_ The default is True.

email.policy.Compat32.header_store_parse()

header_store_parse(name, value) The name and value are returned unmodified.

email.policy.Compat32.header_source_parse()

header_source_parse(sourcelines) The name is parsed as everything up to the ‘:‘ and returned unmodified. The value is determined by stripping leading whitespace off the remainder of the first line, joining all subsequent lines together, and stripping any trailing carriage return or linefeed characters.

email.policy.Compat32.header_fetch_parse()

header_fetch_parse(name, value) If the value contains binary data, it is converted into a Header object using the unknown-8bit charset. Otherwise it is returned unmodified.

email.policy.Compat32.fold_binary()

fold_binary(name, value) Headers are folded using the Header folding algorithm, which preserves existing line breaks in the value, and wraps each resulting line to the max_line_length. If cte_type is 7bit, non-ascii binary data is CTE encoded using the unknown-8bit charset. Otherwise the original source header is used, with its existing line breaks and any (RFC invalid) binary data it may contain.

email.policy.Compat32.fold()

fold(name, value) Headers are folded using the Header folding algorithm, which preserves existing line breaks in the value, and wraps each resulting line to the max_line_length. Non-ASCII binary data are CTE encoded using the unknown-8bit charset.

email.policy.Compat32

class email.policy.Compat32(**kw) This concrete Policy is the backward compatibility policy. It replicates the behavior of the email package in Python 3.2. The policy module also defines an instance of this class, compat32, that is used as the default policy. Thus the default behavior of the email package is to maintain compatibility with Python 3.2. The following attributes have values that are different from the Policy default: mangle_from_ The default is True. The class provides the

email.parser.Parser.parsestr()

parsestr(text, headersonly=False) Similar to the parse() method, except it takes a string object instead of a file-like object. Calling this method on a string is exactly equivalent to wrapping text in a StringIO instance first and calling parse(). Optional headersonly is as with the parse() method.

email.parser.Parser.parse()

parse(fp, headersonly=False) Read all the data from the file-like object fp, parse the resulting text, and return the root message object. fp must support both the readline() and the read() methods on file-like objects. The text contained in fp must be formatted as a block of RFC 2822 style headers and header continuation lines, optionally preceded by an envelope header. The header block is terminated either by the end of the data or by a blank line. Following the header block is the body of