Re: [exim] Spamassassin and pipe

Top Page
Delete this message
Reply to this message
Author: Stian Jordet
Date:  
To: Paul Jolly
CC: exim-users
Subject: Re: [exim] Spamassassin and pipe
On sø., 2008-05-18 at 11:17 +0100, Paul Jolly wrote:
> All,
>
> I have searched high and low for some documentation or examples on the
> subject of using spamassassin in a filter file via the pipe command
> but have turned up nothing (all the documents I have seen refer to the
> site-wide install). I am hoping someone can help with my request.
>
> I need to be able to have spamassassin check an email via a local
> spamassassin install on my shell account (specifically I want to be
> able to utilise the whitelist checking) from within a .forward filter
> specification. Having read the documentation I can see that one would
> probably pipe the mail to the spamassassin command; however the
> default behaviour of spamassassin when run in this way is to output
> the results onto STDOUT (which is treated as an error by exim's filter
> processor).
>
> So I imagine I need to pipe the results of spamassassin back into exim
> for redelivery. How do I achieve this?


I don't really remember why I did it this way, but this works for me.
I'm using it this way because I first check the mail for spam in an ACL.
If it is SPAM, I want to run it through SA again (yeah, I have to many
CPU-cycles to burn :P) to create the report. Anyway, this is how I do
it:

transport_filter = /bin/sh -c '${if eq{$acl_m2}{spam}{/usr/bin/spamc
-U /var/run/spamd.sock -u $acl_m1}{/bin/cat}}'

-Stian