diff --git a/app/models.py b/app/models.py index 96b303c5..c0eca242 100644 --- a/app/models.py +++ b/app/models.py @@ -257,6 +257,28 @@ class DmarcCheckResult(EnumE): } +class SPFCheckResult(EnumE): + allow = 0 + fail = 1 + soft_fail = 1 + neutral = 2 + temp_error = 3 + none = 4 + perm_error = 5 + + @staticmethod + def get_string_dict(): + return { + "R_SPF_ALLOW": SPFCheckResult.allow, + "R_SPF_FAIL": SPFCheckResult.fail, + "R_SPF_SOFTFAIL": SPFCheckResult.soft_fail, + "R_SPF_NEUTRAL": SPFCheckResult.neutral, + "R_SPF_DNSFAIL": SPFCheckResult.temp_error, + "R_SPF_NA": SPFCheckResult.none, + "R_SPF_PERMFAIL": SPFCheckResult.perm_error, + } + + class Hibp(Base, ModelMixin): __tablename__ = "hibp" name = sa.Column(sa.String(), nullable=False, unique=True, index=True) diff --git a/email_handler.py b/email_handler.py index 6c816b89..4f03854a 100644 --- a/email_handler.py +++ b/email_handler.py @@ -2601,10 +2601,11 @@ class MailHandler: elapsed = time.time() - start LOG.i( - "Finish mail_from %s, rcpt_tos %s, takes %s seconds <<===", + "Finish mail_from %s, rcpt_tos %s, takes %s seconds with return code '%s'<<===", envelope.mail_from, envelope.rcpt_tos, elapsed, + ret, ) newrelic.agent.record_custom_metric("Custom/email_handler_time", elapsed) newrelic.agent.record_custom_metric("Custom/number_incoming_email", 1)