procmail
[Top] [All Lists]

Re: Setting Central auto-responder

1997-09-24 13:24:46
Excerpts from mail: (24-Sep-97) Setting Central auto-responder by Charles Gagnon
My setup is simple, I put the procmail recipe to do the reply in a
centalized /etc/procmailrc on my mailsvr. The address I need the
auto-repond on is not a real user, it's an alias to 6 other users (in
/etc/mail/aliases).

Problem1: Mail appear to be from root. I need to forge the from line.

Use `formail' like so:

:0fhw
| formail -I "From: mailinglist(_at_)foo(_dot_)com"

or add the '-I "From: mailinglist(_at_)foo(_dot_)com"' *after* the other 
arguments when
you use `formail -r' to create the autoresponse message.

You might want to add a `Reply-To:' header as well to protect against
improperly written mail programs. Don't forget to add an `X-Loop:' header!

Problem2: My setup sends 6 responses, one for each user that the mail is
forwarded too. Again, the alias is setup in /etc/mail/aliases

We use aliases here for small mailing lists, too, and I've been considering
how to insert procmail spam-checking to filter out spam sent to those lists
before the e-mail gets passed onto the mailing list members. Here's the idea
that I've come up with, but I haven't had a chance to try it out yet, so
there might be some gotchas that I haven't thought of:

I'm guessing your sendmail alias looks like this:

mailinglist:    :include:/etc/mail/lists/mailinglist.members

Change that to look like this:

mailinglist: "|/usr/local/bin/procmail -m /etc/mail/handlelist.rc mailinglist 
/etc/mail/lists/mailinglist.members"

Then, move your autoresponder recipe from /etc/procmailrc to
/etc/mail/handlelist.rc (or some similar name/location) with a little bit of
extra stuff like so:

# Assign procmail arguments to variables...
MAILING_LIST_NAME=$1
MEMBERS_FILE=$2

MAILING_LIST_ADDRESS="$MAILING_LIST_NAME(_at_)foo(_dot_)bar(_dot_)com"

# Do autoresponse.
:0c
{
    # Based on the autoresponder from procmailex(5) man page just as
    # an example...
    :0h
    * !^FROM_DAEMON
    * !^X-Loop: $\MAILING_LIST_ADDRESS
    | (formail -r -A"Precedence: junk" \
           -A"X-Loop: $MAILING_LIST_ADDRESS" \
           -I"From: $MAILING_LIST_ADDRESS" ; \
           echo "Mail received.") | $SENDMAIL -oi -t

}

:0
!`cat $MEMBERS_FILE`

As long as the file size of /etc/mail/lists/mailinglist.members is less than
$LINEBUF - 1, you shouldn't have any problems. You said your mailing list
only has six people, so that should be no problem. But if it grows
significantly, keep in mind that you will have to bump up $LINEBUF...

Later,
Ed

<Prev in Thread] Current Thread [Next in Thread>