You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by gb...@apache.org on 2018/02/23 18:17:29 UTC

svn commit: r1825154 - /spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/FreeMail.pm

Author: gbechis
Date: Fri Feb 23 18:17:29 2018
New Revision: 1825154

URL: http://svn.apache.org/viewvc?rev=1825154&view=rev
Log:
check for freemail for all emails in a Reply-To header
bz #6664

Modified:
    spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/FreeMail.pm

Modified: spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/FreeMail.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/FreeMail.pm?rev=1825154&r1=1825153&r2=1825154&view=diff
==============================================================================
--- spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/FreeMail.pm (original)
+++ spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/FreeMail.pm Fri Feb 23 18:17:29 2018
@@ -424,24 +424,26 @@ sub check_freemail_header {
         }
     }
 
-    my $email = lc($pms->get(index($header,':') >= 0 ? $header : $header.":addr"));
+    my @emails = map (lc, $pms->{main}->find_all_addrs_in_line ($pms->get($header)));
 
-    if ($email eq '') {
-        dbg("header $header not found from mail");
-        return 0;
+    if (!scalar (@emails)) {
+         dbg("header $header not found from mail");
+         return 0;
     }
-    dbg("address from header $header: $email");
+    dbg("addresses from header $header: ".join(';',@emails));
 
-    if ($self->_is_freemail($email)) {
-        if (defined $re) {
-            return 0 unless $email =~ $re;
-            dbg("HIT! $email is freemail and matches regex");
-        }
-        else {
-            dbg("HIT! $email is freemail");
-        }
-        $self->_got_hit($pms, $email, "Header $header is freemail");
-        return 0;
+    foreach my $email (@emails) {    
+        if ($self->_is_freemail($email)) {
+            if (defined $re) {
+                next unless $email =~ $re;
+                dbg("HIT! $email is freemail and matches regex");
+            }
+            else {
+                dbg("HIT! $email is freemail");
+            }
+            $self->_got_hit($pms, $email, "Header $header is freemail");
+            return 1;
+         }
     }
 
     return 0;