sawmill.handler.email

class sawmill.handler.email.Email(host='localhost', port=25, credentials=None, *args, **kw)[source]

Bases: sawmill.handler.base.Handler

Output log records to email.

__init__(host='localhost', port=25, credentials=None, *args, **kw)[source]

Initialise handler with host and port to connect to SMTP server.

credentials may be supplied as a tuple of (username, password) if the server requires a login.

Note

Messages are expected to be constructed by the formatter and is where attributes such as sender, recipients, subject and content should be set.

output(data)[source]

Output formatted data.

data should be a list of prepared Message instances that will be sent using the configured SMTP server. In addition each message must specify the keys ‘To’ and ‘From’ which will be used when sending the email.