procmail
[Top] [All Lists]

Re: Forwarding through the same filter

1998-01-28 13:19:19
At 07:07 PM 1/28/98 +0000, Kay Hayen wrote:

:0:
* ^TOlistname(_at_)kayhayen(_dot_)com
! address1(_at_)anywhere(_dot_)com address2(_at_)kayhayen(_dot_)com ...

The problem is with the address2(_at_)kayhayen(_dot_)com mail. Won't
it just trap the repice in an infite loop with doing some
very nasty mail food for address1(_at_)anywhere(_dot_)com too?

Add an X-Loop to the forwarded message (you should do this anyway), and
check for that on the inbound messages.  Further, you could check for the
user-specific addresses BEFORE the list address, though any time the list
AND a local user are carboned (or multiple local users), you're generally
screwed because you won't know for which THIS copy of the message is for
(and you might get one for ALL addresses, or you might one for EACH
address, depending on the mailer config).

I run my lists under a separate subdomain and user account, which ensures
that if there is a message addressed to the list AND to a virtual user,
they'll get separate copies.  You however probably don't have this option.
Bummer.

But for testing and archiving purposes at least I'd
need a copy for myself and some "aliases" I've created.

Then copy them to the default folder for yourself.

How is it that the alias mailboxes are handled?  Are they forwards, or do
these people retrieve mail from your system somehow?


The following should do a bang-up job of running a simple list for you.
This does not limit posts from subscribers only, and the subscriber file is
a space delimited list of addresses (no names, just addresses).  The
subscription maintenance is handled by a separate script and support
program (not included here), but you can just as easily edit in vi.

This is cranked out from a template I have, and all I do is punch in a
couple of values, and instant remailer:

#       File:           listname.rc
#       Description:    ProcMail script for listname mailing list
#
#       This ProcMail script archives list messages using gzip, and resends
#       to a distribution list, modifying the headers to direct replies to
#       the list.
#
#       Revisions:
#
#       01.00.00  28 JAN 1998 (98028)   11:43:25        SBS
#       Initial Coding.
#

# Uncomment this line (and the one at the bottom) to enable extensive
# logfile information.
#VERBOSE=on

# change these items as appropriate

# name of list for file references (case sensitive, suggested to use all
lower)
listname=listname

# preferred list name (used in places where the address is exported in
headers)
# WordCase this as desired
plistname=listname

# domain of the host account
domain=kayhayen.com

# Address of the list owner.  This is added to outbound list messages and is
# also checked for on inbound mail.  This *can* be a direct link to the list
# owner address (in which case, if they are remote, the mail won't show up
# here), or it can be a virtualized address, which in turn is forwarded to
# the listadmin address, which should be the ACTUAL individual address.
# I do it this way for several reasons:  more professional looking.  Better
# anonymity for the admin.  The admin can go "on vacation" and have the
# admin address changed to someone else - and mail will be directed to them
# (even for older posts).  All admin messages can be archived locally if
# they come through here.
listowner=$listname-mailer(_at_)$domain
listadmin=kay(_at_)kayhayen(_dot_)com


# The following are generally left at their defaults - they are built from
# items defined above.

# This is the long name of the list.  Not used for all list types
# (that is, discussion lists do not use it, but outbound-only does).
listlongname=$plistname Remailer

# This is the fully qualified list address.  This is exported to outbound
# messages, and is also used in address checks below.
listaddr=$plistname(_at_)$domain

# this is the file in which the distribution list is stored.  Note that
# the LISTDIR variable must have previously been defined, and that the host
# user must have read permissions to this file.
listdist=$LISTDIR/$listname

############################################################################
# Modify only commented items below for specific features.

# Note use of -f option is based on being a trusted user.
# if the host user isn't trusted, this won't break anything, but then the
# list can't completely disguise itself (in a virtual environment).
# odi for interractive (time consuming)
# odb for background
# odq for queue
sendmailOPT=" -oem -odb -oi -f$listaddr "

# This rule archives mail to the listowner in the list archive.
# Note this is valid only for TO: addressing.
:1 c: $TEMP/$listname$LOCKEXT
* $^To:.$listowner
|gzip -9fc>>$MAILDIR/$listname.owner.gz

# This rule then (conditioned on the above rule matching) forwards all
# listowner mail to whoever the administrator is.
# we check for and add X-Loop, but otherwise leave the headers alone.
:0 A
{
        :0
        * !^X-Loop:.*$listowner
        | ( formail -a"X-Loop: $listowner" ) | sendmail $listadmin

        # Otherwise, the listowner loop already existed, which means this
        # was a BOUNCE for sending to that user - STOP here, don't send again!
        :0
        /dev/null
}

# This rule archives mail to the list, but from a mailer-daemon,
# Note this is valid only for ANY recipeient (CC or otherwise)
:1 c: $TEMP/istname$LOCKEXT
* $^TO$listaddr
* ^FROM_MAILER
|gzip -9fc>>$MAILDIR/$listname.owner.gz

# This rule then (conditioned on the above rule matching) forwards all
# listowner mail to whoever the administrator is.
:0 A
{
        :0
        * !^X-Loop:.*$listowner
        | ( formail -a"X-Loop: $listowner" ) | sendmail $listadmin

        # Otherwise, the listowner loop already existed, which means this
        # was a BOUNCE for sending to that user - STOP here, don't send again!
        :0
        /dev/null
}


# This rule archives mail to the list in the list archive.
# Note that this is valid for ANY recipient (CC or otherwise).
# This has alternatley been ^To:. and ^TO_
:1 c: $TEMP/$listname$LOCKEXT
* $^TO$listaddr
|gzip -9fc>>$MAILDIR/$listname.gz


# optional rule -- for non-discussion, outbound-only mailing lists
# If it isn't from the list itself (such as a server-generated message), or
# the list administrator, forward the message to the list admin.
# This happens when someone replies to a message, or is otherwise posting
# from out of the list.
#:0 A
#* $!^From:.$listaddr
#* $!^From:.$listadmin
#! $listadmin


# Main header munger for submissions passing through this list.

# options:
# when enabling/disabling options, remember that they need a continuation
# escape, and the last line should NOT have one.

:0 A wfh
| formail -b -IReturn-Receipt-To: -IErrors-To: \
   -I"Return-Path: <$listowner>" \
   -iX-Envelope-To: -iX-Envelope-From: \
   -I"Precedence: list" -I"Resent-Sender: $listowner" \
   -a"X-Loop: $listaddr" \
   -I"Reply-To: $listaddr" \
   -a"Subject: Unidentified subject!" \
   -a"X-Mailing-List: <$listaddr>" \
   -IResent-From:

# Optional user maileragent headers to purge.  Best for keeping outbound
# only lists clean from debris.
#   -IX-Sender: \
#   -IX-Mailer: \
#   -IX-Lotus-FromDomain: \

# optional action - removes all the pre-existing received headers
# useful for outbound only lists, but typically it loses too much info on
# regular remailers (some users like to see where the message has been).
#   -IReceived: \

# For outbound-only lists, we can also SET the FROM (this allows authorized
# posters to all appear to be the same).
#   -I"From: $listaddr ($listlongname)" \

#   -I"Resent-From: $listaddr"
#   -I"Resent-Date: `date`"


#
# The following recipe will distribute the message to the subscribers.
#

:0 Aw
! $sendmailOPT `cat $listdist`

#VERBOSE=off

---
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

 Sean B. Straw / Professional Software Engineering
 Post Box 2395 / San Rafael, CA  94912-2395

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