There's no need for any rules:

whitelist_to us...@example.com
whitelist_to *@domain.com

And adjust USER_IN_WHITELIST_TO for score.

(welcomelist_to / USER_IN_WELCOMELIST_TO in 4.0)


On Wed, Jan 11, 2023 at 04:56:21PM -0800, Loren Wilton wrote:
> ?
> Why not do a simple rule rather than inventing some Perl code?
>  
> header TO_SPECIFIC_EMAIL To:addr ~= '(?:\b[1]us...@example.com|\b[2]
> us...@example.com|\b[3]us...@example.com)'
> describe TO_SPECIFIC_EMAIL Mail to a specific email address
> score TO_SPECIFIC_EMAIL -2
>  
> header TO_SPECIFIC_DOMAIN To:addr '(?:'\@example1\.com | \@example2\.com | \
> @example3\.com)'
> describe TO_SPECIFIC_DOMAIN Mail to specific email domain
> score TO_SPECIFIC_DOMAIN -2
>  
>     or possibly
>  
> header TO_SPECIFIC_DOMAIN To:addr '\@(?:example1\.com | example2\.com |
> example3\.com)$'
>  
>  
>         Loren
> 
>     ----- Original Message -----
>     From: [4]Joey J
>     To: [5]users@spamassassin.apache.org
>     Sent: Wednesday, January 11, 2023 3:39 PM
>     Subject: Rule Help - not sure what is wrong with my syntax
> 
>     Hello All,
> 
>     I created this rule to check for email addresses matching a list to get
>     added some negative value.
>     I also tried it with just domains so it would be more efficient, but I
>     can't seem to get them to run.
>     Any suggestions?
> 
>     header TO_SPECIFIC_EMAIL eval:check_to_specific_email()
>     describe TO_SPECIFIC_EMAIL Mail to a specific email address
> 
>     score TO_SPECIFIC_EMAIL -2
> 
>     sub check_to_specific_email {
>         my ($self) = @_;
>         my $to = lc($self->get('To:addr'));
>         my $list_of_address = qr/[6]us...@example.com|[7]us...@example.com|[8]
>     us...@example.com/;
>         if ($to =~ $list_of_address) {
>             return 1;
>         }
>         return 0;
>     }
> 
> 
> 
>     --------------------------------------------------------------------
>     This version was to simply check for the domain matches, but can't seem to
>     get it to work
>     --------------------------------------------------------------------
> 
>     header TO_SPECIFIC_DOMAIN eval:check_to_specific_domain()
>     describe TO_SPECIFIC_DOMAIN Mail to specific email domain
> 
>     score TO_SPECIFIC_DOMAIN -2
> 
>     sub check_to_specific_domain {
>         my ($self) = @_;
>         my $to = lc($self->get('To:addr'));
>         if ($to =~ /\@example1\.com$|\@example2\.com$|\@example3\.com$/) {
>             return 1;
>         }
>         return 0;
>     }
> 
> 
> 
> 
> 
> 
>     --
>     Thanks!
>     Joey
> 
> 
> 
> References:
> 
> [1] mailto:bus...@example.com
> [2] mailto:bus...@example.com
> [3] mailto:bus...@example.com
> [4] mailto:jacklistm...@gmail.com
> [5] mailto:users@spamassassin.apache.org
> [6] mailto:us...@example.com
> [7] mailto:us...@example.com
> [8] http://us...@example.com/

Reply via email to