Andreas Pettersson wrote:
> Hi.
> I have some difficulties with large mails and spam scanning.
> I'm setting several headers depending on the score, like this
[snip]
> but because there are warns that don't have the $message_size condition, 
> SpamAssassin gets called for mails larger than 500K (it just don't set 
> the X-Spam-Flag header). One obvius solution is to add a $message_size 
> condition to each and every warn, but is there any 'nicer' way to solve 
> this?

Once the spam condition has been run, you don't need to re-run it in 
subsequent acl stanzas -- the variables are already set by the first 
run. So you can do this:

   warn  message = X-Spam-Flag: YES
        condition = ${if < {$message_size}{500K}}
         spam = nobody

   warn  message = X-Spam-Q: 1
        condition = ${if def:spam_score_int}
         condition = ${if >= {$spam_score_int}{50}{1}{0}}
         condition = ${if < {$spam_score_int}{100}{1}{0}}

   warn  message = X-Spam-Q: 2
        condition = ${if def:spam_score_int}
         condition = ${if >= {$spam_score_int}{100}{1}{0}}
         condition = ${if < {$spam_score_int}{150}{1}{0}}

This has the added benefit of not re-running spamassassin for each 
stanza when spamassassin fails (due to a pathalogical message) if you 
decide to use defer_ok.

If your spam checks are at the end of the ACL (or pulled out into a 
called sub-acl), you can make it even simpler by just accepting 
over-sized messages up front:

   accept condition = ${if >= {$message_size}{500K}}

   warn  message = X-Spam-Flag: YES
         spam = nobody

   warn  message = X-Spam-Q: 1
         condition = ${if >= {$spam_score_int}{50}{1}{0}}
         condition = ${if < {$spam_score_int}{100}{1}{0}}

   warn  message = X-Spam-Q: 2
         condition = ${if >= {$spam_score_int}{100}{1}{0}}
         condition = ${if < {$spam_score_int}{150}{1}{0}}

- Marc

-- 
## List details at http://www.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://www.exim.org/eximwiki/

Reply via email to