You are given MailResponse objects from the lamson.view methods, and
whenever you want to generate an email to send to someone. It has the
same basic functionality as MailRequest, but it is designed to be written
to, rather than read from (although you can do both).
You can easily set a Body or Html during creation or after by passing
it as __init__ parameters, or by setting those attributes.
You can initially set the From, To, and Subject, but they are headers
so use the dict notation to change them: msg['From'] =
'joe@test.com'.
The message is not fully crafted until right when you convert it with
MailResponse.to_message. This lets you change it and work with it, then
send it out when it's ready.
|
|
__init__(self,
To=None,
From=None,
Subject=None,
Body=None,
Html=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
attach(self,
filename=None,
content_type=None,
data=None,
disposition=None)
Simplifies attaching files from disk or data as files. |
source code
|
|
|
|
attach_part(self,
part)
Attaches a raw MailBase part from a MailRequest (or anywhere) so that
you can copy it over. |
source code
|
|
|
|
attach_all_parts(self,
mail_request)
Used for copying the attachment parts of a mail.MailRequest object
for mailing lists that need to maintain attachments. |
source code
|
|
|
|
|
|
|
update(self,
message)
Used to easily set a bunch of heading from another dict like object. |
source code
|
|
|
|
|
|
|
_encode_attachment(self,
filename=None,
content_type=None,
data=None,
disposition=None,
part=None)
Used internally to take the attachments mentioned in self.attachments
and do the actual encoding in a lazy way when you call to_message. |
source code
|
|
|
|
to_message(self)
Figures out all the required steps to finally craft the message you
need and return it. |
source code
|
|
|
|
|
|
|
|
|
Inherited from object:
__delattr__,
__format__,
__getattribute__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__,
__sizeof__,
__subclasshook__
|