On July 26, 1996, Aditya Vedula <avedula(_at_)cs(_dot_)uml(_dot_)edu> said:
Hi,
I'm new to procmail.I was going through the man pages for procmail,
and the idea that I could have an automatic mailing-list sounded good.This
is what it looks right now :
------------------------------------------------------------------------------
:0 c
* ^Subject:.friend
!someone(_at_)nowhere(_dot_)com sumbuddy(_at_)nowhere(_dot_)com\
summunelse(_at_)nowhere(_dot_)com
:0 A
friendfile
------------------------------------------------------------------------------
From what I understand, it looks in the beginning of the subject
header for the word "friend" and simply forwards it to the addresses given
below.I would like to append some text to the forwarded mail... something like
a signature file.I would like to know how I could do that.
You know, I find extremely cool that within a day of getting on the
procmail mailing list (and within three days of starting to use procmail) I
can answer a question. Certainly seems to imply procmail's easy to learn
...
I was dealing with something of a similar problem because I wanted to
auto-bounce messages from a specific source back to the source (and several
other people; in case you care, it's to deal with some horrible spam I'm
getting). After looking at the procmailex man page, I've got:
01- :0
02- * ^From:.*moneyworld.com
03- | ( /usr/local/bin/formail \
04- -czrki"Subject: Unsolicited Advertisement Returned" \
05- -I"From: autoresponder
<autoresp(_at_)rsr(_dot_)vip(_dot_)best(_dot_)com>" \
06- -A"cc: postmaster(_at_)mci(_dot_)net" \
07- -A"cc: hostmaster(_at_)mci(_dot_)net" \
08- -A"cc: spamcomplaints(_at_)mci(_dot_)net" \
09- ; /home/rsr/bin/fuck "chag" moneyworld.com chag(_at_)moneyworld(_dot_)com
"") \
10- | $SENDMAIL -oi -t
(line numbers added for convenience).
Lines 01 and 02 are pretty obvious (and I suspect some people here may even
recognize the domain name). At line 3 I start a shell command (with the
'|'. The parenthesis serve to explicitly tell the program to both use
formail and my own program ('fuck'. Uhh, sorry. I'll change the name when
I get a chance, but it fits the message it prints) and pipe their combined
output to sendmail.
Line 3 invokes formail; feel free to read its manpage to see what the
'czrki' args do. Line 5 replaces the original 'From:' line with my own
'From:' line, lines 6, 7, and 8 add cc recipients.
Line 8 then invokes my program, a simple perl program that outputs:
---
This mail is being sent to the originator of the enclosed
email message and to all postmasters and InterNIC domain
contacts which have references associated with the sender's
domain (moneyworld.com). The user 'chag'
(chag(_at_)moneyworld(_dot_)com) does not in any way, shape or form
compensate me for my time and disk space used in receipt
and processing of this message. Any further mail received
from this address will be taken as the sender's agreement
to pay me for said time and disk space at the rate of $100
per each unsolicited email message, and the agreement of
all postmasters responsible for this user's network access
to assume liability for any incured charges should the
sender refuse to pay. I will also call upon others to
propagate global filter bans pending termination of the
spam and payment of amounts due per the terms specified
herein. This will remedy the problem the hard way by
essentially causing isolation of the offender and the
providers allowing him to spam from the rest of the
network.
Sincerely,
Roy S. Rapoport
---
And the original message (quoted with '>' but you can reset that to
whatever you want including nothing) and the message my program outputs are
piped to sendmail for mailing.
Procmail's pretty nifty.
roy
-----------------------------------------------------------------
Roy S. Rapoport UNIX/Mac System Administrator
rsr(_at_)ide(_dot_)com http://www.ide.com
Phone: 415-543-1314x280 Fax: 415-543-0145