Package posterity :: Package util :: Module mail

Module mail



Classes
  EmailAddressList
Email address list class
Functions
 
parse_rfc2822_date(text)
Parse an rfc2822 date string into a datetime object.
 
encode_header(value, charset=None)
Encodes mail headers.
 
decode_header(text)
Decode a header value and return the value as a unicode string.
 
unwrap_flowed(text)
Unwrap paragraphs that have been wrapped with "soft" new lines according to rfc2646.
 
quote_text(text)
Quote text by prepending '>'-characters to each line
 
reflow_quoted_text(text, width=72)
Reflow text with 'soft' (SP CR LF) newlines according to rfc2646
 
wrap_flowed(text, width=72)
Wrap long lines with 'soft' (SP CR LF) newlines according to rfc2646.
 
send_msg(account, identity, subject, payload, to, cc=None, in_reply_to=None, references=None)
Build and send an email message
 
decode_text_part(part)
Extract the payload from a text/plain mime part as a unicode string
 
decode_text_plain_part(part)
Function Details

encode_header(value, charset=None)

 

Encodes mail headers.

If value is a list each list item will be encoded separately and returned as a comma separated list. If value is a tuple it will be interpreted as (name, email).

reflow_quoted_text(text, width=72)

 

Reflow text with 'soft' (SP CR LF) newlines according to rfc2646

Text paragraphs containing 'soft' newlines are reflowed for a maximum line length of @width characters. Only non-quoted text is reflowed (Lines not starting with '>').

>>> reflow_quoted_text('Foo \nBar')
'Foo Bar'
>>> reflow_quoted_text('> Foo \n> Bar')
'> Foo \r\n> Bar'
>>> reflow_quoted_text('> Foo \nBar ')
'> Foo \r\nBar'
>>> reflow_quoted_text('> Foo\n\n> Bar')
'> Foo\r\n\r\n> Bar'
>>> reflow_quoted_text('> Foo \n'                      'a b \n'                      'c d e g h i j k l m\n'                      '> Bar', width=10)
'> Foo \r\na b c d e \r\ng h i j k \r\nl m\r\n> Bar'