I have the following string:
spf=pass (sender IP is 198.71.245.6)
smtp.mailfrom=bounces.em.godaddy.com; domainname.com.au; dkim=pass (signature was
verified) header.d=godaddy.com;domainname.com.au; dmarc=pass action=none
header.from=godaddy.com;
With the following code:
if "Authentication-Results" in n:
auth_results = n['Authentication-Results']
print(auth_results)
spf = re.match(r"spf=(\w+)", auth_results)
if spf:
spf_result = spf.group(1)
dkim = re.match(r"^.*dkim=(\w+)", auth_results)
print(dkim)
if dkim:
dkim_result = dkim.group(1)
The SPF always matches but the DKIM doesn't:
print(dkim) = None
According to the regex testers online it should: https://regex101.com/r/ZkVg74/1 any ideas why it's not i also tried these:
dkim = re.match(r"dkim=(\w+)", auth_results)
dkim = re.match(r"^.*dkim=(\w+)", auth_results, re.MULTILINE)