procmail
[Top] [All Lists]

Re: Using procmail for small mailing lits

2002-07-12 17:24:31
You are doing exactly what I need to do, and then some. I guess I wasn't
clear. I have a separate mailbox for the list. It's just if I have anyone
else in the domain on the list I get the loops. so my list is
list(_at_)domain(_dot_)com

and if I have me(_at_)domain(_dot_)com in the list it was creating a loop.

I'll go through what you sent and should be able to make it work for me.

Thanks for your help,
michael

----- Original Message -----
From: "Professional Software Engineering" 
<PSE-L(_at_)mail(_dot_)professional(_dot_)org>
To: <procmail-users(_at_)procmail(_dot_)org>
Sent: Friday, July 12, 2002 4:02 PM
Subject: Re: Using procmail for small mailing lits


At 15:20 2002-07-12 -0700, Michael DeSimone did say:
First of all I am brand new to using Procmail. I switched ISP's and they
do
not offer any mail list software so I am trying to use a Procmail recipe
to
do this.

That's tricky when you're using one account to host the whole lot.  Tack
on
an X-Loop: header to all your list resends (which is the proper thing to
do
anyway), and your list won't attempt to reprocess them.

Remember, procmail is not an MTA.  Using it to share one mailbox for
multiple users is always fraught with problems.

I finally have most of what I want to do working. However, I can't have
anyone from my domain on the list as it creates a mail loop.
How can I fix this? I also would like to alter the Subject line so that
[listname] is the first thing in the subject line.

I use procmail for small mailing lists, but I don't manage them from
WITHIN
a user account receiving mail - it's handled on a user account which is
ONLY mailing lists.

Here's something to mull over.  Note that there are several variables
defined externally to the script.  See my disclaimer - most of them should
be represented in the the sandbox template.  I'm fairly certain I've
genericised this sufficiently, but then, it wasn't written for outside
use.  I've used THIS script for quite a few years, and prior to this, I
used something rather similar.  It has worked quite well for me -- but
within a separate account space.


#       File:           list.rc
#       Description:    ProcMail script for simple 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  31 OCT 1997 (97304)   22:35:04        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=yourlistname

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

# domain of the host account
domain=host.domain.tld

# 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=youraddress(_at_)host(_dot_)domain(_dot_)tld


# 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: $listname$LOCKEXT
* $^To:.$listowner
|gzip -9fc>>$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
{
         # NOTE: if the listowner address is local, you should probably
just
         # deposit it into a mailbox file here, NOT try to forward it to a
user
         # whose email is filtered in the same chain this rcfile is in.
         :0
         * !^X-Loop:.*$listowner
         | ( formail -a"X-Loop: $listowner" ) | $SENDMAIL $listadmin

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

# This rule archives mail to the list, if from a mailer.
# Note this is valid when the list is ANY recipeient (CC or otherwise)
# (this is catching boneheaded bounced which are sent to From: or To:,
# instead of the sender).
:1 c: $listname$LOCKEXT
* $^TO_$listaddr
* ^FROM_MAILER
|gzip -9fc>>$listname.owner.gz

# This rule then (conditioned on the above rule matching) forwards all
# listowner mail to whoever the administrator is.
:0 A
{
         # NOTE: if the listowner address is local, you should probably
just
         # deposit it into a mailbox file here, NOT try to forward it to a
user
         # whose email is filtered in the same chain this rcfile is in.
         :0
         * !^X-Loop:.*$listowner
         | ( formail -a"X-Loop: $listowner" ) | $SENDMAIL $listadmin

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


#
#       Check for multipart attachments.  We're now mandatorily bouncing
the
#       buggers because no-one seems to care about the rules anymore.
#       chop this out if you don't want this functionality.  It's a real
#       buttsaver though when some moron sends a 5MB attachment through
your
#       list...
#
:0
* $^TO$listaddr
* ^Content-Type:[       ]*multipart/(mixed|related);
{
         # file a copy for later ref (for the admin)
         :0c: $listname.reject$LOCKEXT
         |gzip -9fc>>$listname.reject.gz

         # Now, churn out a bounce message to the submitter.
         # If it is looped or from the mailer daemon, do nothing more.
         # (this recipe needs a 'c' on the preceeding recipe to work)
         :0h
         * !^FROM_DAEMON
         * !^X-Loop: $listname-reject(_at_)$domain
         | ( formail -rt -A "X-Loop: $listname-reject(_at_)${domain}" \
                 -I "Subject: REJECTED: $SUBJECT" \
                 -I "From: $listowner ($plistname rejection mailbot)" ;\
                 cat $AUTOREPLY/$listname.reject.msg ) | $SENDMAIL -t
}

# This rule archives mail to the list in the list archive.
# Note that this is valid for ANY recipient (CC or otherwise).
:1 c: $listname$LOCKEXT
* $^TO$listaddr
|gzip -9fc>>$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"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.
#   -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 -
# and it's useful for spam checking).
#   -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)" \

# If you do the replacement of From, you might want to add this.  You'd
# need to enable the simple METOO address extraction above though.
#   -I"X-Admin-From: $METOO" \

#   -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

---
  Sean B. Straw / Professional Software Engineering

  Procmail disclaimer:
<http://www.professional.org/procmail/disclaimer.html>
  Please DO NOT carbon me on list replies.  I'll get my copy from the
list.

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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