procmail
[Top] [All Lists]

Re: Delivering to several users

1996-11-13 09:58:43
    > At our ISP we have our own domain.  All mail sent to anyone
    > @our.domain goes into one main account.

Is there a reason for this multiplexing?  If you wish to exercise
control over all incoming mail, with procmail it is not necessary to
multiplex this way.  Instead, you can use a global /etc/procmailrc file
to filter *all* mail handled by procmail.

    > I have set up a Linux-box to act as a mailserver.
    > 
    > To fetch the mail I use popclient:
    > popclient -3 -s -u $POPUSER -p $POPPASS -o $TEMPMAIL $POPSERVER
    > 
    > And to sort out mail to my local users:
    > cat $TEMPMAIL | /usr/local/bin/formail -I Status: -ds 
/usr/local/bin/procmail
    > 
    > This is run by cron as root. And have a .procmailrc in /root
    > 
    > Is this ok btw?

If it is working, and you have a good reason for the multiplexing, then
it must be ok.
    
    > --- Start .procmailrc ---
    > 
    > # Please check if all the paths in PATH are reachable, remove the ones 
that
    > # are not.
    > #VERBOSE=on
    > HOME=/root
    > PATH=$HOME:/usr/bin:/bin:/usr/local/bin:.
    > MAILDIR=$HOME/Mail                        # You'd better make sure it 
exists
    > DEFAULT=/var/spool/mail/root
    > LOGFILE=$MAILDIR/from
    > LOCKFILE=$HOME/.lockmail
    > SHELL=/bin/sh
    > #LOGABSTRACT=on
    > 
    > # To make a backup of all incoming mail in case
    > # some one looses his mail-folder:
    > :0 c
    > safe.copy

This will get very big very fast, and, since it contains *everyone's*
mail, your system manager or postmaster must be very cautious and
discrete with its contents.

    > :0
    > * ^TOtore.andersson
    > !tore
    > 
    > :0
    > * ^TOper.brorson
    > !per
    > 
    > [ Deleted ~20 users for readability ]
    > 
    > # Anything that has not been delivered by now will go to $DEFAULT
    > # using LOCKFILE=$DEFAULT$LOCKEXT
    > 
    > --- End .procmailrc ---
    > 
    > - All mail gets copied into safe.copy alright
    > - Mail for a user gets delivered alright.
    > - Other mail goes into $DEFAULT alright.
    > 
    > But what happens if someone sends a mail to "tore" AND "per" ?

The way the recipe is arranged now, it only goes to the first person
found.

    > When matching "tore" the recipe is finished and next mail is
    > processed.

True.  When a match is found, the mail is delivered to that one address
and processing stops.

    > Do I have to add a c-flag on every recipe?

If you wish mail to multiple addresses, then yes, you will need to use
"c" flags.

    > Then $DEFAULT will also get a copy of all mail?

Yes, unless you either explicitly do a final action, or set DELIVERED.
Ie:

    :0c
    * ^TOtore.andersson
    !tore
    :0c
    * ^TOper.brorson
    !per
    #... and all other recipes for each person
    :0  # file it in default unless filed already
    * ! LASTFOLDER ?? .
    $DEFAULT

Or..

    :0c
    * ^TOtore.andersson
    !tore
    :0c
    * ^TOper.brorson
    !per
    #... and all other recipes for each person
    :0  # set DELIVERED if LASTFOLDER is set
    * LASTFOLDER ?? .
    { DELIVERED=yes }


    > about lockfiles?
    > Do I have to use ":" on all recipes?
    >  (probably not becasue "!user" invokes sendmail, or what?)

When feeding mail to a process which accepts input from STDIN and
doesn't depend upon any changing file's state, you do not need
lockfiles.

    > Any comments, tips, hints?
    > 
    > Another question:
    > How can I use /etc/aliases instead of specifying all users?
    > 
    > /etc/aliases:
    > tore.andersson :tore
    > per.brorson    :per

If you check the archives, I sent mail not too long ago which showed how
one could maintain a small ASCII database, like /etc/aliases, of user
names and addresses, which could automatically be converted into a
procmail filter for the same purpose as yours.  If you cannot find my
mail in the archives, send me a note, and I'll send it again.

    > Whee.. that was a lot of questions! Sorry!

Yes, but you have done your homework, and have a basic plan already.
Some people don't even read the manual and ask "So, how do I use this thing?"

Good luck!
___________________________________________________________
Alan Stebbens <aks(_at_)sgi(_dot_)com>      http://reality.sgi.com/aks

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