procmail
[Top] [All Lists]

Minor problem delivering mail to one or more of several people

1998-04-23 13:06:07
Hi.  I'm using procmail to split out mail from a common maildrop to
one or more people, depending on the To/Cc lines.  If, for instance,
procmail sees mail "To: john, jane" it should deliver it to both.

I'm also using it to handle some simple mail aliases, e.g. "support"
and "info" which go to various people.  I want to make these work in
combination, so "To: support, gary" sends to all the people on support
plus gary (I don't care if gary gets it twice, his procmail will
filter out the duplicates).

Lastly, I want to deliver it to everyone if no rules matched.

The way I implement this is to use continuation (:0 c) rules for each
possible recipient or list, and then I check if $LASTFOLDER is
assigned at the end.  If it hasn't been assigned by any of the above
rules, I deliver to everyone.  But the problem is what to do
otherwise!  I want to do nothing, but if I get to this point in the
.procmailrc, procmail will deliver the mail to $DEFAULT, and that's
what will go into the log file.  So my log file always says
"/dev/null" got the message, which is ugly.  Is there anything I can
do about that?

Here's what I have so far:


:0 c
* ^TO(gary|(gary[._-])?oberbrunner)
! gary(_at_)real-address

:0 c
* ^TO([ck]arl|([ck](arl)?[._-]?)?sims|karls)
! karl(_at_)real-address

:0 c
* ^TO([ck]athr[yi]ne?)
! kathryn(_at_)real-address

:0 c
* ^TO(postmaster|root|admin|webmaster)
! gary(_at_)real-address

:0 c
* ^TO(sales|info|mktg|license)
! karl(_at_)real-address kathryn(_at_)real-address

:0 c
* ^TO(support)
! karl(_at_)real-address gary(_at_)real-address

# Otherwise, if nothing above has delivered the mail to someone,
# deliver it to everyone.

:0
* ? test -z "$LASTFOLDER"
! karl(_at_)real-address gary(_at_)real-address kathryn(_at_)real-address

# If the last recipe failed, it's because the mail *was* delivered.
# Here we must deliver to /dev/null to avoid delivering to $DEFAULT.
:0E
/dev/null

Thanks!  Please cc: me on replies, as I don't normally read this list.

-- 
Gary Oberbrunner                        Genetic Arts, Inc.
email: garyo(_at_)genarts(_dot_)com             8 Clinton St.
phone: (617) 492-2888  (fax:-2852)      Cambridge, MA 02139

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