log event when there's no dmarc result

This commit is contained in:
Son 2022-03-25 16:19:11 +01:00
parent ce2d2a3b3a
commit 63b1100a8b
2 changed files with 6 additions and 0 deletions

View File

@ -1451,7 +1451,9 @@ def get_dmarc_status(msg: Message) -> Optional[DmarcCheckResult]:
sep = spam_entries[entry_pos].find("(")
if sep > -1:
spam_entries[entry_pos] = spam_entries[entry_pos][:sep]
for header_value, dmarc_result in DmarcCheckResult.get_string_dict().items():
if header_value in spam_entries:
return dmarc_result
return None

View File

@ -547,6 +547,10 @@ def apply_dmarc_policy(
newrelic.agent.record_custom_event(
"Custom/dmarc_check", {"result": dmarc_result.name}
)
else:
newrelic.agent.record_custom_event(
"Custom/dmarc_check", {"result": "N/A"}
)
if not DMARC_CHECK_ENABLED or not dmarc_result:
return None