Tony Marsh wrote:
> Hi there,
>
> I've recently shoehorned exim4 & spamassassin onto a linux box I had
> lying around (well, sort of - it's mainly a mythtv box, but that's not
> the problem). Mail is fetched via fetchmail from a pop mailbox, has
> some spamassassin headers removed (thanks to a really badly configured
> mailserver, I can't rely on this instance of spamassassin) fed through
> spamassassin, and then fowarded to a single gmail account. this
> process, is on the whole working fine. Spamassassin is even catching
> spam as fetchmail picks it up, which is great.
>
> But there's a problem.. The 2 variables above are showing up empty in
> the headers of my email, making dealing with what little spam that's
> making it though pretty hard indeed.
>
> To save everyone's mailbox, examples of headers, as well as my exim
> filters are tucked away on pastebin: http://pastebin.ca/938827
>
> Any help will be very much appreciated!
>
While the "message" text is calculated after everything in the ACL has
been run, the "set acl" is run as it is hit in the ACL. Since your "spam
= user" is run AFTER the "set acl", it doesn't have any values in the
spam variables.
Using "spam=user:true" means that the condition returns true regardless
of if the message is spam or not, so you don't need to include it once
SA has been run the first time. The $spam_score and $spam_score_int
variables are completely global and may or may not be cleared between
messages (I can't remember if that was fixed or not).
Try re-arranging the first one as so:
#
# Adds spam score
#
warn message = X-Spam-Score: $spam_score ($spam_bar)
condition = ${if <{$message_size}{250k}{1}{0}}
spam = spamassassin:true
# the variables are now set
set acl_m8 = X-Spam-Score: $spam_score ($spam_bar)
#
# Add the spam Flag if over 5
#
warn message = X-Spam-Flag: Yes
condition = ${if >={$spam_score_int}{50}{1}{0}}
condition = ${if <{$message_size}{250k}{1}{0}}
set acl_m9 = X-Spam-Flag: Yes
# You don't actually need the spam=whatever here if you're not using it
# for a condition
# spam = spamassassin:true
#
# Add the spam report header
#
warn message = X-Spam-Status: $spam_report
set acl_m0 = X-Spam-Status: $spam_report
condition = ${if <{$message_size}{250k}{1}{0}}
# and again - this one always returns true .. no point having it
# spam = spamassassin:true
#
# Deny when over 10
#
deny message = SPAM - Message scored $spam_score spam points
condition = ${if >={$spam_score_int}{100}{1}{0}}
condition = ${if <{$message_size}{250k}{1}{0}}
# ditto
spam = spamassassin:true
This should make sure that the message is only scanned if it's over a
certain size. Of course if you want this header all the time, then you
might want to run SA before all these with a special warn statement and
then use an ${if def:var} type arrangement on the rest.
--
The Exim Manual
http://www.exim.org/docs.html
http://www.exim.org/exim-html-current/doc/html/spec_html/index.html