Re: copy spam mail to separate mailbox

2009-07-23 Thread Martin Gregorie
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





Re: copy spam mail to separate mailbox

2009-07-23 Thread Dan Schaefer


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

--
Dan Schaefer
Web Developer/Systems Analyst
Performance Administration Corp.



Re: copy spam mail to separate mailbox

2009-07-18 Thread mouss
Evan Platt a écrit :
> At 11:22 AM 7/16/2009, you 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

if you use amavisd-new, configure it to add a "+spam" extension. then in
postfix, use recipient_bcc_maps:

/^(.*)\+s...@example\.com$/  somebox...@example.net

I am assuming you use '+' as an extension delimiter.


if you don't want to use amavisd-new, then it's easier to do this in
your delivery agent (dovecot+sieve, maildrop, ... etc). otherwise, you
can use FILTER instead of REDIRECT to pass the message to a script
(which will need to resubmit mail. beware of infinite loops here).

> 
> As that's really a postfix question, not a SpamAssassin question, if you
> don't get an answer here you may want to try on a postfix mailing list. 

indeed.


Re: copy spam mail to separate mailbox

2009-07-16 Thread Jack Pepper

Quoting Dan Schaefer :



As that's really a postfix question, not a SpamAssassin question,  
if you don't get an answer here you may want to try on a postfix  
mailing list.
I know. Since everybody here is so great at answering my questions  
so far, I thought I'd try this list first.




$> cat .procmailrc
PMDIR=$HOME/Procmail  # Make sure this directory exists!
LOGFILE=$PMDIR/pmlog
LOG="
"
MAILDIR=$HOME/Mail
# VERBOSE=yes

:0
* ^Subject:.*\[SPAM\]
$HOME/Mail/Spam/

# EOF

This is about the simplest procmail recipe to do what you ask.  there  
are many much more robust examples in the googlesphere, but maybe this  
gets you started.


jp


--
Simple compliance is a hacker's best friend


@fferent Security Labs:  Isolate/Insulate/Innovate  
http://www.afferentsecurity.com




Re: copy spam mail to separate mailbox

2009-07-16 Thread Randy
Evan Platt wrote:
> At 11:22 AM 7/16/2009, you 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
>
> As that's really a postfix question, not a SpamAssassin question, if
> you don't get an answer here you may want to try on a postfix mailing
> list. 
Procmail. Set postfix to use this as local delivery agent. Then create a
"recipe" that does what you want.

"procmailrc"

SPAMIT="$whatever_dir_you_want_to_use/.SPAM/"
:0:
* ^X-Spam-Status: Yes
$SPAMIT


This would need to be modified for your specs of course.

RCR


Re: copy spam mail to separate mailbox

2009-07-16 Thread Jari Fredriksson
> 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

Needs scripting. If the target spambox is on same server, a cp will do with 
correct owner adjustmetnts in the script, but if it is on some remote server, a 
more complex 'sendmail' call will be required (I have neved done this).

I have a 'grabspam' script which copies spam-folder from specficified user to 
the spam-user. Nothing special in it, the email is just a file in the file 
system (if using Maildir -format).






Re: copy spam mail to separate mailbox

2009-07-16 Thread Dan Schaefer


As that's really a postfix question, not a SpamAssassin question, if 
you don't get an answer here you may want to try on a postfix mailing 
list. 
I know. Since everybody here is so great at answering my questions so 
far, I thought I'd try this list first.


--
Dan Schaefer
Web Developer/Systems Analyst
Performance Administration Corp.



Re: copy spam mail to separate mailbox

2009-07-16 Thread Evan Platt

At 11:22 AM 7/16/2009, you 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


As that's really a postfix question, not a SpamAssassin question, if 
you don't get an answer here you may want to try on a postfix mailing list.  



copy spam mail to separate mailbox

2009-07-16 Thread Dan Schaefer
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

--
Dan Schaefer
Web Developer/Systems Analyst
Performance Administration Corp.