Email action¶
Spidermon provides two built-in actions that can be used to send email reports in the configuration of a monitor suite.
SendSESEmail
uses Amazon Simple Email Service as the method to send your emails.SendSmtpEmail
uses SMTP as the method to send your emails.
Basic usage of both actions are very similar. You just need to configure the desired action in you monitor suite and configure a few specific settings depending on the action you choose.
For example, to send an email report using Amazon Simple Email Service when
your DummyMonitorSuite
finishes, you can use:
from spidermon.contrib.actions.email.ses import SendSESEmail
class DummyMonitorSuite(MonitorSuite):
monitors = [
DummyMonitor,
]
monitors_finished_actions = [
SendSESEmail,
]
A second example, if you want to send an email report using SMTP when
your DummyMonitorSuite
finishes and some monitor fails, you can use:
from spidermon.contrib.actions.email.smtp import SendSmtpEmail
class DummyMonitorSuite(MonitorSuite):
monitors = [
DummyMonitor,
]
monitors_failed_actions = [
SendSmtpEmail,
]
By default Spidermon uses a HTML template that can be altered in SPIDERMON_BODY_HTML_TEMPLATE setting. You can use Jinja2 as your template engine.
The result of a report generated using this default template may be seen next:


Available settings¶
The following settings are used by all email actions
(SmtpSendEmail
or SendSESEmail
).
SPIDERMON_EMAIL_TO¶
Default: None
List of all recipients of the email notification.
The following settings can be used to improve the action:
SPIDERMON_BODY_HTML¶
Default: None
SPIDERMON_BODY_HTML_TEMPLATE¶
String containing the location of the Jinja2 template for the Spidermon email report.
Default reports/email/monitors/result.jinja
.
SPIDERMON_BODY_TEXT¶
SPIDERMON_BODY_TEXT_TEMPLATE¶
SPIDERMON_EMAIL_BCC¶
Default: None
SPIDERMON_EMAIL_CONTEXT¶
Default: None
SPIDERMON_EMAIL_CC¶
Default: None
SPIDERMON_EMAIL_FAKE¶
Default: False
If set True, the email content will be in the logs but no email will be sent.
SPIDERMON_EMAIL_REPLY_TO¶
SPIDERMON_EMAIL_SUBJECT¶
SPIDERMON_EMAIL_SUBJECT_TEMPLATE¶
Amazon SES action settings¶
The following settings are needed only if you are using SendSESEmail
action.
SPIDERMON_AWS_ACCESS_KEY¶
Default: None
AWS Access Key.
Warning
This setting has been deprecated in preference of SPIDERMON_AWS_ACCESS_KEY_ID
.
SPIDERMON_AWS_SECRET_KEY¶
Default: None
AWS Secret Key.
Warning
This setting has been deprecated in preference of SPIDERMON_AWS_SECRET_ACCESS_KEY
.
SPIDERMON_AWS_ACCESS_KEY_ID¶
Default: None
AWS Access Key. If not set, it defaults to AWS_ACCESS_KEY_ID (scrapy
credentials for AWS S3 storage).
SPIDERMON_AWS_SECRET_ACCESS_KEY¶
Default: None
AWS Secret Key. If not set, it defaults to AWS_SECRET_ACCESS_KEY (scrapy
credentials for AWS S3 storage).
SMTP action settings¶
The following settings are needed only if you are using SmtpSendEmail
action.