procmail
[Top] [All Lists]

Re: Possible procmail filter to trap spam relays?

1998-06-09 00:03:31
On Tue, Jun 09, 1998 at 12:40:26AM -0400, Walter Dnes wrote:
:0:
* blah blah blah
| echo "X-Reject: blah blah blah">>junkmail ;cat - >>junkmail

vs.

:0:
* blah blah blah
| formail -A "X-Reject: blah blah blah" >>junkmail

Well, the main problem I see with the former is that you get the X-Reject
header in there before the 'From ' line.  Most MUA's separate messages
based on that line, so your X-Reject headers will probably become part of
the last message.  Ick.

It looks like formail should exist everywhere [the latest version of]
procmail does, providing it's installed correctly:

SOURCE
       This program is part of the procmail mail-processing-pack-
       age  (v3.11pre7  1997/04/28)  available  at  your  nearest
       USENET  comp.sources.misc  archive,   or   at   ftp.infor-
       matik.rwth-aachen.de     as    pub/packages/procmail/proc-
       mail.tar.gz.


...on another note:

What's the best method to filter based on the -a argument provided to
procmail?  (sendmail, when configured to use procmail as a local mailer,
passes the part after the + in the username of the sender to procmail
this way.)

Also, any suggestions on the best method to modify the Subject line
(i.e. with sed) on incoming messages?  I could just do:

        :0:
        * ^From linux-mac68k-owner(_at_)wave(_dot_)lm(_dot_)com
        | sed 's/^Subject: \[linux-mac68k\] /Subject: /' >> linux-mac68k

However, that also changes the body.  formail lets me grab only the
headers, but I don't know how to tack the body back onto the message
after I'm done with it.

The formail man page says that I can alternatively extract headers via
sed -e '/^$/ q', but I don't know enough about sed to get this to work
with the previous substitution command.  Suggestions?

Thanks,

-- 
**************************************************************
Tristan Horn                            voice: +1-650-482-2840
Network Operations Center               fax:   +1-650-482-2844
PRIORI NETWORKS, INC.                   http://www.priori.net/
              "Tomorrow's Performance... Today"
**************************************************************

Attachment: pgpbsMwkF0jMb.pgp
Description: PGP signature