spamassassin-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RW <rwmailli...@googlemail.com>
Subject Re: From name containing a spoofed email address
Date Tue, 23 Jan 2018 00:09:43 GMT
On Mon, 22 Jan 2018 10:05:14 -0500
Rupert Gallagher wrote:

> This is my current solution for a problem that has been discussed
> many times in this list.

> 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
>      }
>   }
> }

This is a case-sensitive comparison. 

Mime
View raw message