On Thu, 2009-07-23 at 10:48 -0400, Dan Schaefer wrote:
> > I have a postfix/SA setup and I was wondering if anyone knew how to 
> > COPY an email marked as spam instead of redirecting.
> > Not this:
> > /^X-Spam-Flag: YES/   REDIRECT spam...@example.com
> >
> This should work, right?
> http://onetforum.com/fourm/viewtopic.php?f=2&t=34
> 
The spamfilter script in it looks to be incomplete. Take a look at this
example instead: http://onetforum.com/fourm/viewtopic.php?t=26

You need to replace the pipeline in the script with commands that:

1) save the script's arguments 
2) store the spamc output in a temporary file.
3) look at the stored message with grep or awk to see if its spam.
   Either will do the job, but awk will be faster because it can
   be scripted to just look at the headers.
4) If the message is spam, replace the last argument (the recipient)
   with the address that should receive spam.
5) use sendmail to pass the message back to Postfix using the
   arguments stored in (1) and modified in (4)
6) delete the file.

Of course, if performance is important you can write this as a C program
that stores the message in memory while its deciding what to do with it.


Martin



Reply via email to