assembl.models.mail module

assembl.models.post.Post that came as email, and utility code for handling email.

class assembl.models.mail.AbstractFilesystemMailbox(**kwargs)[source]

Bases: assembl.models.mail.AbstractMailbox

A Mailbox refers to an Email inbox that is stored the server’s filesystem.

class assembl.models.mail.AbstractMailbox(**kwargs)[source]

Bases: assembl.models.generic.PostSource

A Mailbox refers to any source of Email, and whose messages should be imported and displayed as Posts. It must not be instanciated directly

static guess_encoding(blob)[source]

Blobs should be ascii, but sometimes are multiply-encoded utf-8, probably a bug of the underlying library. Temporary patch until it is fixed.

message_ok_to_import(message_string)[source]

Check if message should be imported at all (not a bounce, vacation, etc.)

The reference is La référence est http://tools.ietf.org/html/rfc3834

most_common_recipient_address()[source]

Find the most common recipient address of the contents of this emaila address. This address can, in most use-cases can be considered the mailing list address.

parse_email(message_string, existing_email=None)[source]

Creates or replace a email from a string

reprocess_content()[source]

Allows re-parsing all content as if it were imported for the first time but without re-hitting the source, or changing the object ids. Call when a code change would change the representation in the database

send_post(post)[source]

Send a new post in the discussion to the source.

static strip_full_message_quoting_html(message_body)[source]

Assumes any encoding conversions have already been done

static strip_full_message_quoting_plaintext(message_body)[source]

Assumes any encoding conversions have already been done

class assembl.models.mail.Email(*args, **kwargs)[source]

Bases: assembl.models.post.ImportedPost

An Email refers to an email message that was imported from an AbstractMailbox.

REWRITEMEreply(sender, response_body)[source]

Send a response to this email.

sender is a user instance. response is a string.

body_mime_type

The mime type of the body of the imported content. See Content::get_body_mime_type() for allowed values.

message_id

The email-compatible message-id for the post.

source_post_id

The source-specific unique id of the imported post. A listener keeps the message_id in the post class in sync

class assembl.models.mail.IMAPMailbox(**kwargs)[source]

Bases: assembl.models.mail.AbstractMailbox

A IMAPMailbox refers to an Email inbox that can be accessed with IMAP.

get_send_address()[source]

Get the email address to send a message to the discussion

class assembl.models.mail.MaildirMailbox(**kwargs)[source]

Bases: assembl.models.mail.AbstractFilesystemMailbox

A Mailbox refers to an Email inbox that is stored as maildir on the server.

class assembl.models.mail.MailingList(**kwargs)[source]

Bases: assembl.models.mail.IMAPMailbox

A mailbox with mailing list semantics (single post address, subjetc mangling, etc.)

get_send_address()[source]

Get the email address to send a message to the discussion