Mail Messaging
Last updated
from cement import App
with App('myapp') as app:
app.run()
# send a message using the defined mail handler
app.mail.send("Test mail message",
subject='My Subject',
to=['me@example.com'],
from_addr='noreply@localhost',
)python myapp.py
=============================================================================
DUMMY MAIL MESSAGE
-----------------------------------------------------------------------------
To: me@example.com
From: noreply@localhost
CC:
BCC:
Subject: My Subject
---
Test mail message
-----------------------------------------------------------------------------from cement import App
from cement.core.mail import MailHandler
class MyMailHandler(MailHandler):
class Meta:
label = 'my_mail_handler'
# do something to implement the interface
class MyApp(App):
class Meta:
label = 'myapp'
mail_handler = 'my_mail_handler'
handlers = [
MyMailHandler,
]