Email-based exception handler

This commit is contained in:
David Baer
2020-01-22 22:46:21 -05:00
parent 96168629b6
commit 00a988744e
3 changed files with 38 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ from lxml.etree import parse as parse_xml
from dmarcreceiver.model import DBSession, Report, ReportError, ReportRecord, OverrideReason, DKIMResult, SPFResult, metadata, init_model
import transaction
from .util import sendmail
from .util import sendmail, install_exception_handler
from .config import config
def parse_metadata(tree):
@@ -89,6 +89,10 @@ def receive_report(args):
# read email message from stdin
msg = message_from_file(sys.stdin)
# if not running on a tty, install email-based exception handler
if not sys.stderr.isatty():
install_exception_handler(msg)
# check for zip file
content_type = msg['content-type']
if content_type.find(';') != -1: