cement.core.mail
¶
Cement core mail module.
-
class
cement.core.mail.
MailHandler
(**kw)[source]¶ Bases:
cement.core.mail.MailInterface
,cement.core.handler.Handler
Mail handler implementation.
Configuration
This handler supports the following configuration settings:
- to - Default
to
addresses (list, or comma separated depending on the ConfigHandler in use) - from_addr - Default
from_addr
address - cc - Default
cc
addresses (list, or comma separated depending on the ConfigHandler in use) - bcc - Default
bcc
addresses (list, or comma separated depending on the ConfigHandler in use) - subject - Default
subject
- subject_prefix - Additional string to prepend to the
subject
- to - Default
-
class
cement.core.mail.
MailInterface
(**kw)[source]¶ Bases:
cement.core.interface.Interface
This class defines the Mail Interface. Handlers that implement this interface must provide the methods and attributes defined below. In general, most implementations should sub-class from the provided
MailHandler
base class as a starting point.-
class
Meta
[source]¶ Bases:
object
Handler meta-data.
-
interface
= 'mail'¶ The label identifier of the interface.
-
-
send
(body, **kwargs)[source]¶ Send a mail message. Keyword arguments override configuration defaults (cc, bcc, etc).
Parameters: body (str) – The message body to send
Keyword Arguments: Returns: True
if message was sent successfully,False
otherwiseReturn type: Example
# Using all configuration defaults app.mail.send('This is my message body') # Overriding configuration defaults app.mail.send('My message body' to=['john@example.com'], from_addr='me@example.com', cc=['jane@example.com', 'rita@example.com'], subject='This is my subject', )
-
class