Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# Imports
3from django.conf import settings
4from django.core.mail import send_mail
5from django.template import loader
6from .base import ErrorHandler
8# Exports
10__all__ = (
11 "Email",
12)
14# Constants
16ERROR_CAPTURE_FROM_EMAIL = getattr(settings, "SUPERDJANGO_ERROR_CAPTURE_FROM_EMAIL", "webmaster@example.com")
18# Classes
21class Email(ErrorHandler):
22 """Send email regarding an error."""
24 required_settings = [
25 "SUPERDJANGO_ERROR_CAPTURE_EMAILS",
26 ]
28 def handle(self, report):
29 """Send email to addresses defined in ``SUPERDJANGO_ERROR_CAPTURE_EMAILS``."""
30 body = self._parse_template("errors/email_body.txt")
31 subject = self._parse_template("errors/email_subject.txt")
33 send_mail(subject, body, ERROR_CAPTURE_FROM_EMAIL, settings.SUPERDJANGO_ERROR_CAPTURE_EMAILS)
35 return None