diff --git a/spidermon/contrib/actions/email/__init__.py b/spidermon/contrib/actions/email/__init__.py index bc5249ea..24684504 100644 --- a/spidermon/contrib/actions/email/__init__.py +++ b/spidermon/contrib/actions/email/__init__.py @@ -59,8 +59,11 @@ def __init__( raise NotConfigured( "You must provide at least one recipient for the message." ) - if not self.subject: - raise NotConfigured("You must provide a subject for the message.") + if not self.subject and not self.subject_template: + raise NotConfigured( + "You must provide a subject (SPIDERMON_EMAIL_SUBJECT) or subject " + "template (SPIDERMON_EMAIL_SUBJECT_TEMPLATE) for the message." + ) if not ( self.body_text or body_text_template or body_html or self.body_html_template ):