wuttjamaican.email.message

Email Message

class wuttjamaican.email.message.Message(key=None, sender=None, subject=None, to=None, cc=None, bcc=None, replyto=None, txt_body=None, html_body=None)[source]

Represents an email message to be sent.

Parameters:

to – Recipient(s) for the message. This may be either a string, or list of strings. If a string, it will be converted to a list since that is how the to attribute tracks it. Similar logic is used for cc and bcc.

All attributes shown below may also be specified via constructor.

key

Unique key indicating the “type” of message. An “ad-hoc” message created arbitrarily may not have/need a key; however one created via make_auto_message() will always have a key.

This key is not used for anything within the Message class logic. It is used by make_auto_message() when constructing the message, and the key is set on the final message only as a reference.

sender

Sender (From:) address for the message.

subject

Subject text for the message.

to

List of To: recipients for the message.

cc

List of Cc: recipients for the message.

bcc

List of Bcc: recipients for the message.

replyto

Optional reply-to (Reply-To:) address for the message.

txt_body

String with the text/plain body content.

html_body

String with the text/html body content.

as_string()[source]

Returns the complete message as string. This is called from within deliver_message() to obtain the SMTP payload.