Class Message

Superclasses :
util::Error
Package :
mail

This class represents an email message

Source

Class summary
Methods inherited from util::Error
error(a) get_reason()
Variables inherited from util::Error
reason
Methods defined in this class
add_bcc(a) add_cc(a) add_from(m) add_header(key, val) add_reply_to(a) add_resent_bcc(a) add_resent_cc(a) add_resent_from(m) add_resent_to(a) add_to(a) catenate_addresses(a, delim) fold(s) fold1(res, l) get_actual_content_transfer_encoding() get_actual_content_type() get_bcc() get_catenated_headers(key, delim) get_cc() get_content() get_content_disposition() get_content_object() get_content_transfer_encoding() get_content_type() get_date() get_decoded_content() get_encoding_handler() get_first_header(key) get_from() get_headers(key) get_reply_to() get_resent_bcc() get_resent_cc() get_resent_date() get_resent_from() get_resent_sender() get_resent_to() get_sender() get_subject() get_to() get_type_handler() has_header(key) initially() parse(data) set_bcc(a) set_cc(a) set_content(s) set_content_disposition(cd) set_content_object(o) set_content_transfer_encoding(s) set_content_type(ct) set_date(t) set_decoded_content(s) set_from(m) set_header(key, val) set_reply_to(a) set_resent_bcc(a) set_resent_cc(a) set_resent_date(t) set_resent_from(m) set_resent_sender(m) set_resent_to(a) set_sender(m) set_subject(s) set_to(a) show_headers() show_message() to_rfc822() unset_header(key)
Variables defined in this class
content headers parser

Method detail

add_bcc(a)

Add a "bcc" header from the given parameter, which may be either a single Address, or a list of several Addresses.
Parameters :
a - an Address or a list of Addresses.
Source

add_cc(a)

Add a "cc" header from the given parameter, which may be either a single Address, or a list of several Addresses.
Parameters :
a - an Address or a list of Addresses.
Source

add_from(m)

Add a "From" header from the given parameter, which may be either a single Mailbox, or a list of several Mailboxes.
Parameters :
a - an Mailbox or a list of Mailboxes.
Source

add_header(key, val)

Add a header with the given key, after any existing ones with the same key
Source

add_reply_to(a)

Add a "Reply-To" header from the given parameter, which may be either a single Address, or a list of several Addresses.
Parameters :
a - an Address or a list of Addresses.
Source

add_resent_bcc(a)

Add a "Resent-bcc" header from the given parameter, which may be either a single Address, or a list of several Addresses.
Parameters :
a - an Address or a list of Addresses.
Source

add_resent_cc(a)

Add a "Resent-cc" header from the given parameter, which may be either a single Address, or a list of several Addresses.
Parameters :
a - an Address or a list of Addresses.
Source

add_resent_from(m)

Add a "Resent-From" header from the given parameter, which may be either a single Mailbox, or a list of several Mailboxes.
Parameters :
a - an Mailbox or a list of Mailboxes.
Source

add_resent_to(a)

Add a "Resent-To" header from the given parameter, which may be either a single Address, or a list of several Addresses.
Parameters :
a - an Address or a list of Addresses.
Source

add_to(a)

Add a "To" header from the given parameter, which may be either a single Address, or a list of several Addresses.
Parameters :
a - an Address or a list of Addresses.
Source

catenate_addresses(a, delim)

Private method, not intended for client invocation

fold(s)

Private method, not intended for client invocation

fold1(res, l)

Private method, not intended for client invocation

get_actual_content_transfer_encoding()

Private method, not intended for client invocation

get_actual_content_type()

Private method, not intended for client invocation

get_bcc()

Get the "bcc" header(s) as a list of Address instances.
Fails :
if the "bcc" header is absent or cannot be parsed as a list of Addresses
Returns :
a list of Address instances
Source

get_catenated_headers(key, delim)

Get all the headers matching the given key as a string separated by the given delimeter, which defaults to ","
Fails :
if there is no header with the given key
Source

get_cc()

Get the "cc" header(s) as a list of Address instances.
Fails :
if the "bcc" header is absent or cannot be parsed as a list of Addresses
Returns :
a list of Address instances
Source

get_content()

Get the content
Source

get_content_disposition()

Get the "Content-Disposition" header as a ContentDisposition intance.
Fails :
if the "Content-Disposition" header is absent or cannot be parsed.
Returns :
a ContentDisposition
Source

get_content_object()

Retrieve an object representation of the decoded data, based on the Content-Type attribute.
Source

get_content_transfer_encoding()

Get the "Content-Transfer-Encoding" field, as a string, or fail if it is an invalid value.
Returns :
a string
Source

get_content_type()

Get the "Content-Type" header as a ContentType intance.
Fails :
if the "Content-Type" header is absent or cannot be parsed.
Returns :
a ContentType
Source

get_date()

Get the "Date" header as a Time object.
Fails :
if the "Date" header is absent or cannot be parsed.
Returns :
a Time instance
Source

get_decoded_content()

Get the decoded content, based on the Content-Transfer-Encoding attribute.
Source

get_encoding_handler()

Private method, not intended for client invocation

get_first_header(key)

A convenience function to get the first header matching the given key, or fail
Source

get_from()

Get the "From" header(s) as a list of Mailbox instances.
Fails :
if the "From" header is absent or cannot be parsed as a list of Mailboxes
Returns :
a list of Mailbox instances
Source

get_headers(key)

Get all the headers for the key, or fail if the key has no headers
Fails :
if no headers for the key have been defined
Returns :
a list of all the headers for the key. This will always be a non-empty list.
Source

get_reply_to()

Get the "Reply-To" header(s) as a list of Address instances.
Fails :
if the "Reply-To" header is absent or cannot be parsed as a list of Addresses
Returns :
a list of Address instances
Source

get_resent_bcc()

Get the "Resent-bcc" header(s) as a list of Address instances.
Fails :
if the "Reset-bcc" header is absent or cannot be parsed as a list of Addresses
Returns :
a list of Address instances
Source

get_resent_cc()

Get the "Resent-cc" header(s) as a list of Address instances.
Fails :
if the "Resent-cc" header is absent or cannot be parsed as a list of Addresses
Returns :
a list of Address instances
Source

get_resent_date()

Get the "Resent-Date" header as a Time instance.
Returns :
a Time
Source

get_resent_from()

Add a "Resent-From" header from the given parameter, which may be either a single Mailbox, or a list of several Mailboxes.
Parameters :
a - an Mailbox or a list of Mailboxes.
Source

get_resent_sender()

Get the "Resent-Sender" header as a Mailbox instance.
Fails :
if the "Resent-Sender" header is absent or cannot be parsed as a Mailbox
Returns :
a Mailbox
Source

get_resent_to()

Get the "Resent-To" header(s) as a list of Address instances.
Fails :
if the "Resent-To" header is absent or cannot be parsed as a list of Addresses
Returns :
a list of Address instances
Source

get_sender()

Get the "Sender" header as a Mailbox instance.
Fails :
if the "Sender" header is absent or cannot be parsed as a Mailbox
Returns :
a Mailbox
Source

get_subject()

Get the subject
Source

get_to()

Get the "To" header(s) as a list of Address instances.
Fails :
if the "To" header is absent or cannot be parsed as a list of Addresses
Returns :
a list of Address instances
Source

get_type_handler()

Helper to get the appropriate type handler
Source

has_header(key)

Succeed iff there is a header with the given key.
Source

initially()


parse(data)

Parse the given raw data into the message data structures.
Source

set_bcc(a)

Set the "bcc" header from the given parameter, which may be either a single Address, or a list of several Addresses. To add further "bcc" headers, use add_bcc.
Parameters :
a - an Address or a list of Addresses.
Source

set_cc(a)

Set the "cc" header from the given parameter, which may be either a single Address, or a list of several Addresses. To add further "cc" headers, use add_cc.
Parameters :
a - an Address or a list of Addresses.
Source

set_content(s)

Set the content
Source

set_content_disposition(cd)

Set the "ContentDisposition" header from a ContentDisposition instance.
Parameters :
cd - a ContentDisposition
Source

set_content_object(o)

Set the content from the given object, which must be consistent with the Content-Type specified in the message.
Source

set_content_transfer_encoding(s)

Set the "Content-Transfer-Encoding" from the given string.
Source

set_content_type(ct)

Set the "ContentType" header from a ContentType instance.
Parameters :
ct - a ContentType
Source

set_date(t)

Set the "Date" header from the given Time object.
Parameters :
t - the Time from which to set the date field.
Source

set_decoded_content(s)

Set the decoded content. The content itself will then be set based on the Content-Transfer-Encoding.
Source

set_from(m)

Set the "From" header from the given parameter, which may be either a single Mailbox, or a list of several Mailboxes. To add further "From" headers, use add_from.
Parameters :
a - an Mailbox or a list of Mailboxes.
Source

set_header(key, val)

Set a header with the given key; any existing headers with the same key are removed.
Source

set_reply_to(a)

Set the "Reply-To" header from the given parameter, which may be either a single Address, or a list of several Addresses. To add further "Reply-To" headers, use add_reply_to.
Parameters :
a - an Address or a list of Addresses.
Source

set_resent_bcc(a)

Set the "Resent-bcc" header from the given parameter, which may be either a single Address, or a list of several Addresses. To add further "Resent-bcc" headers, use add_resent_bcc.
Parameters :
a - an Address or a list of Addresses.
Source

set_resent_cc(a)

Set the "Resent-cc" header from the given parameter, which may be either a single Address, or a list of several Addresses. To add further "Resent-cc" headers, use add_resent_cc.
Parameters :
a - an Address or a list of Addresses.
Source

set_resent_date(t)

Set the "Resent-Date" header from the given Time instance.
Parameters :
t - a Time
Source

set_resent_from(m)

Set the "Resent-From" header from the given parameter, which may be either a single Mailbox, or a list of several Mailboxes. To add further "Resent-From" headers, use add_resent_from.
Parameters :
a - an Mailbox or a list of Mailboxes.
Source

set_resent_sender(m)

Set the "Resent-Sender" header from the given Mailbox instance.
Parameters :
m - a Mailbox
Source

set_resent_to(a)

Set the "Resent-To" header from the given parameter, which may be either a single Address, or a list of several Addresses. To add further "Resent-To" headers, use add_resent_to.
Parameters :
a - an Address or a list of Addresses.
Source

set_sender(m)

Set the "Sender" header from the given Mailbox instance.
Parameters :
m - a Mailbox
Source

set_subject(s)

Set the subject to the given string.
Parameters :
s - a string
Source

set_to(a)

Set the "To" header from the given parameter, which may be either a single Address, or a list of several Addresses. To add further "To" headers, use add_to.
Parameters :
a - an Address or a list of Addresses.
Source

show_headers()

Show the header table (useful debug)
Source

show_message()

Debug output function
Source

to_rfc822()

Return a string representation of the message in RFC822 format.

Source

unset_header(key)

Unset the header(s) for the given key
Source

Variable detail

content


headers


parser