email.message.Message.items()

items() Return a list of 2-tuples containing all the message’s field headers and values.

email.message.Message.is_multipart()

is_multipart() Return True if the message’s payload is a list of sub-Message objects, otherwise return False. When is_multipart() returns False, the payload should be a string object. (Note that is_multipart() returning True does not necessarily mean that “msg.get_content_maintype() == ‘multipart’” will return the True. For example, is_multipart will return True when the Message is of type message/rfc822.)

email.message.Message.get_unixfrom()

get_unixfrom() Return the message’s envelope header. Defaults to None if the envelope header was never set.

email.message.Message.get_payload()

get_payload(i=None, decode=False) Return the current payload, which will be a list of Message objects when is_multipart() is True, or a string when is_multipart() is False. If the payload is a list and you mutate the list object, you modify the message’s payload in place. With optional argument i, get_payload() will return the i-th element of the payload, counting from zero, if is_multipart() is True. An IndexError will be raised if i is less than 0 or greater than or equal to the number of

email.message.Message.get_params()

get_params(failobj=None, header='content-type', unquote=True) Return the message’s Content-Type parameters, as a list. The elements of the returned list are 2-tuples of key/value pairs, as split on the '=' sign. The left hand side of the '=' is the key, while the right hand side is the value. If there is no '=' sign in the parameter the value is the empty string, otherwise the value is as described in get_param() and is unquoted if optional unquote is True (the default). Optional failobj is

email.message.Message.get_param()

get_param(param, failobj=None, header='content-type', unquote=True) Return the value of the Content-Type header’s parameter param as a string. If the message has no Content-Type header or if there is no such parameter, then failobj is returned (defaults to None). Optional header if given, specifies the message header to use instead of Content-Type. Parameter keys are always compared case insensitively. The return value can either be a string, or a 3-tuple if the parameter was RFC 2231 encode

email.message.Message.get_filename()

get_filename(failobj=None) Return the value of the filename parameter of the Content-Disposition header of the message. If the header does not have a filename parameter, this method falls back to looking for the name parameter on the Content-Type header. If neither is found, or the header is missing, then failobj is returned. The returned string will always be unquoted as per email.utils.unquote().

email.message.Message.get_default_type()

get_default_type() Return the default content type. Most messages have a default content type of text/plain, except for messages that are subparts of multipart/digest containers. Such subparts have a default content type of message/rfc822.

email.message.Message.get_content_type()

get_content_type() Return the message’s content type. The returned string is coerced to lower case of the form maintype/subtype. If there was no Content-Type header in the message the default type as given by get_default_type() will be returned. Since according to RFC 2045, messages always have a default type, get_content_type() will always return a value. RFC 2045 defines a message’s default type to be text/plain unless it appears inside a multipart/digest container, in which case it would

email.message.Message.get_content_subtype()

get_content_subtype() Return the message’s sub-content type. This is the subtype part of the string returned by get_content_type().