On Fri, 2018-01-26 at 16:26 -0600, sha...@shanew.net wrote: > Just a hunch, but did you make sure to add the "$self->register..." > line inside the "sub new {" block with all the others in > HeaderEval.pm? > Yep, sure did, thanks for that. All is well now.
> > On Fri, 26 Jan 2018, Chris wrote: > > > On Mon, 2018-01-22 at 10:05 -0500, Rupert Gallagher wrote: > >> This is my current solution for a problem that has been discussed > >> many times in this list. > >> I wrote it last year, and it serves me well. Feel free to use it, > if > >> you find it useful. > >> > >> This part goes into your local.cf: > >> > >> header __F_DM1 eval:from_domains_mismatch() > >> header __F_DM2 From:addr =~ > >> /\@(pec|legalmail|telecompost)(\.[^\.]+)?\.it/ > >> meta F_DM ( __F_DM1 && ! __F_DM2 ) > >> describe F_DM From:name domain mismatches From:addr domain > >> priority F_DM -1 > >> score F_DM 5.0 > >> > >> This part goes into the general HeaderEval.pm: > >> > >> $self->register_eval_rule("from_domains_mismatch"); > >> [...] > >> sub from_domains_mismatch { > >> my ($self, $pms) = @_; > >> my $temp; > >> $temp = $pms->get('From:addr'); > >> $temp =~ /@(.+)/; my $fromAddrDomain; $fromAddrDomain = "$1"; > >> $temp = $pms->get('From:name'); > >> $temp =~ /@([^\@\"\s]+)/; my $fromNameDomain; $fromNameDomain = > >> "$1"; > >> dbg("from_domains_mismatch: fromNameDomain=$fromNameDomain, > >> fromAddrDomain=$fromAddrDomain"); > >> if ( $fromNameDomain eq "" ) { > >> return 0; # all well > >> } else { > >> if( $fromNameDomain eq $fromAddrDomain ) { > >> return 0; # all well, they match > >> } else { > >> return 1; # mismatch, possibly spam > >> } > >> } > >> } > >> > >> R.G. > >> > > Just for the heck of it I added the above to my SpamAssassin setup > at > > home. However my syslog shows: > > > > rules: failed to run __F_DM1 test, skipping: > > (Can't locate object method "from_domains_mismatch" via package > "Mail: > > [...]:SpamAssassin::PerMsgStatus" at (eval 1816) line 19.) > > > > I did restart SA after adding this. SA version 3.4.1 > > > > > > -- > Public key #7BBC68D9 at | Shane Williams > http://pgp.mit.edu/ | System Admin - UT CompSci > =----------------------------------+------------------------------- > All syllogisms contain three lines | sha...@shanew.net > Therefore this is not a syllogism | www.ischool.utexas.edu/~shanew -- Chris KeyID 0xE372A7DA98E6705C 31.11972; -97.90167 (Elev. 1092 ft) 16:48:06 up 8:35, 1 user, load average: 0.42, 0.38, 0.39 Description: Ubuntu 16.04.3 LTS, kernel 4.13.0-32-generic
signature.asc
Description: This is a digitally signed message part