mailbox.MaildirMessage

class mailbox.MaildirMessage(message=None)[source]

Message with Maildir-specific properties.

Methods

__contains__(name)
__delitem__(name) Delete all occurrences of a header, if present.
__getitem__(name) Get a header value.
__init__([message]) Initialize a MaildirMessage instance.
__len__() Return the total number of headers, including duplicates.
__setitem__(name, val) Set the value of a header.
__str__() Return the entire formatted message as a string.
_become_message(message) Assume the non-format-specific state of message.
_explain_to(message) Copy Maildir-specific state to message insofar as possible.
_get_params_preserve(failobj, header)
add_flag(flag) Set the given flag(s) without changing others.
add_header(_name, _value, **_params) Extended header setting.
as_string([unixfrom]) Return the entire formatted message as a string.
attach(payload) Add the given payload to the current payload.
del_param(param[, header, requote]) Remove the given parameter completely from the Content-Type header.
get(name[, failobj]) Get a header value.
get_all(name[, failobj]) Return a list of all the values for the named field.
get_boundary([failobj]) Return the boundary associated with the payload if present.
get_charset() Return the Charset instance associated with the message’s payload.
get_charsets([failobj]) Return a list containing the charset(s) used in this message.
get_content_charset([failobj]) Return the charset parameter of the Content-Type header.
get_content_maintype() Return the message’s main content type.
get_content_subtype() Returns the message’s sub-content type.
get_content_type() Return the message’s content type.
get_date() Return delivery date of message, in seconds since the epoch.
get_default_type() Return the `default’ content type.
get_filename([failobj]) Return the filename associated with the payload if present.
get_flags() Return as a string the flags that are set.
get_info() Get the message’s “info” as a string.
get_param(param[, failobj, header, unquote]) Return the parameter value if found in the Content-Type header.
get_params([failobj, header, unquote]) Return the message’s Content-Type parameters, as a list.
get_payload([i, decode]) Return a reference to the payload.
get_subdir() Return ‘new’ or ‘cur’.
get_unixfrom()
has_key(name) Return true if the message contains the header.
is_multipart() Return True if the message consists of multiple parts.
items() Get all the message’s header fields and values.
keys() Return a list of all the message’s header field names.
remove_flag(flag) Unset the given string flag(s) without changing others.
replace_header(_name, _value) Replace a header.
set_boundary(boundary) Set the boundary parameter in Content-Type to ‘boundary’.
set_charset(charset) Set the charset of the payload to a given character set.
set_date(date) Set delivery date of message, in seconds since the epoch.
set_default_type(ctype) Set the `default’ content type.
set_flags(flags) Set the given flags and unset all others.
set_info(info) Set the message’s “info” string.
set_param(param, value[, header, requote, ...]) Set a parameter in the Content-Type header.
set_payload(payload[, charset]) Set the payload to the given value.
set_subdir(subdir) Set subdir to ‘new’ or ‘cur’.
set_type(type[, header, requote]) Set the main type and subtype for the Content-Type header.
set_unixfrom(unixfrom)
values() Return a list of all the message’s header values.
walk() Walk over the message tree, yielding each subpart.