email.message.Message.set_unixfrom()

set_unixfrom(unixfrom) Set the message’s envelope header to unixfrom, which should be a string.

email.message.Message.set_type()

set_type(type, header='Content-Type', requote=True) Set the main type and subtype for the Content-Type header. type must be a string in the form maintype/subtype, otherwise a ValueError is raised. This method replaces the Content-Type header, keeping all the parameters in place. If requote is False, this leaves the existing header’s quoting as is, otherwise the parameters will be quoted (the default). An alternative header can be specified in the header argument. When the Content-Type header

email.message.Message.set_payload()

set_payload(payload, charset=None) Set the entire message object’s payload to payload. It is the client’s responsibility to ensure the payload invariants. Optional charset sets the message’s default character set; see set_charset() for details.

email.message.Message.set_param()

set_param(param, value, header='Content-Type', requote=True, charset=None, language='', replace=False) Set a parameter in the Content-Type header. If the parameter already exists in the header, its value will be replaced with value. If the Content-Type header as not yet been defined for this message, it will be set to text/plain and the new parameter value will be appended as per RFC 2045. Optional header specifies an alternative header to Content-Type, and all parameters will be quoted as n

email.message.Message.set_default_type()

set_default_type(ctype) Set the default content type. ctype should either be text/plain or message/rfc822, although this is not enforced. The default content type is not stored in the Content-Type header.

email.message.Message.set_charset()

set_charset(charset) Set the character set of the payload to charset, which can either be a Charset instance (see email.charset), a string naming a character set, or None. If it is a string, it will be converted to a Charset instance. If charset is None, the charset parameter will be removed from the Content-Type header (the message will not be otherwise modified). Anything else will generate a TypeError. If there is no existing MIME-Version header one will be added. If there is no existing

email.message.Message.set_boundary()

set_boundary(boundary) Set the boundary parameter of the Content-Type header to boundary. set_boundary() will always quote boundary if necessary. A HeaderParseError is raised if the message object has no Content-Type header. Note that using this method is subtly different than deleting the old Content-Type header and adding a new one with the new boundary via add_header(), because set_boundary() preserves the order of the Content-Type header in the list of headers. However, it does not prese

email.message.Message.replace_header()

replace_header(_name, _value) Replace a header. Replace the first header found in the message that matches _name, retaining header order and field name case. If no matching header was found, a KeyError is raised.

email.message.Message.preamble

preamble The format of a MIME document allows for some text between the blank line following the headers, and the first multipart boundary string. Normally, this text is never visible in a MIME-aware mail reader because it falls outside the standard MIME armor. However, when viewing the raw text of the message, or when viewing the message in a non-MIME aware reader, this text can become visible. The preamble attribute contains this leading extra-armor text for MIME documents. When the Parser

email.message.Message.keys()

keys() Return a list of all the message’s header field names.