From 2ceb39c0fbd8a687735a2add3579b98c3c7306d8 Mon Sep 17 00:00:00 2001 From: Giovanni Bechis Date: Fri, 16 Dec 2022 15:58:14 +0100 Subject: [PATCH] do not use tags that are not supported in SpamAssassin 3.4 fix #11 --- Dmarc.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Dmarc.pm b/Dmarc.pm index 156b7e4..b68a548 100644 --- a/Dmarc.pm +++ b/Dmarc.pm @@ -232,10 +232,16 @@ sub _check_dmarc { $spf_helo_status = 'neutral' if ((defined $pms->{spf_helo_neutral}) and ($pms->{spf_helo_neutral} eq 1)); $spf_helo_status = 'softfail' if ((defined $pms->{spf_helo_softfail}) and ($pms->{spf_helo_softfail} eq 1)); - $mfrom_domain = $pms->get('EnvelopeFrom:host', undef); + my $from_addr = $pms->get('EnvelopeFrom:addr'); + if($from_addr =~ /\@(.*)$/) { + $mfrom_domain = $1; + } if(not defined $mfrom_domain) { - $mfrom_domain = $pms->get('From:domain', undef); - dbg("cannot find EnvelopeFrom domain, using From:domain $mfrom_domain"); + $from_addr = $pms->get('From:addr'); + if($from_addr =~ /\@(.*)$/) { + dbg("cannot find EnvelopeFrom domain, using From:domain $mfrom_domain"); + $mfrom_domain = $1; + } } return if not defined $mfrom_domain; $dmarc->source_ip($lasthop->{ip});