procmail
[Top] [All Lists]

Re: managing multiple addresses on virtual host

2001-04-25 11:24:19
On Wed, Apr 25, 2001 at 10:54:35AM -0400, Matthew Manuel wrote:
Hey everyone,

  Again, I have a virtual host setup on my server.  All emails sent to that
host are sent to my account, which invokes procmail.  Procmail then forwards
to the appropriate people, based on the address given.  This has been
working correctly, however I had a thought on the bus last night:  If I have
two addresses, say user1(_at_)manuel(_dot_)ca and user2(_at_)manuel(_dot_)ca, 
and somebody sends
and email with BOTH user1(_at_)manuel(_dot_)ca and user2(_at_)manuel(_dot_)ca 
in the To: header,
won't the following recipe send both copies to user1?

:0
* ^TO_user1(_at_)manuel(_dot_)ca
{
    :0
    ! email1(_at_)host(_dot_)ca
}
:0
* ^TO_user2(_at_)manuel(_dot_)ca
{
    :0
    ! email2(_at_)host(_dot_)ca
}

...as the message would be caught by the first recipe for both copies of the
message.

If the messages gets duplicated upstream then yes, you
would have a problem. You should be able to solve this
by including the duplicate message removal stuff from
procmailex above your recipes. The duplicated messages
should have the same message id, and only one of those
would get through.

If only one message gets through, you may need to do
something like this:

    :0c
    * ^TO_user1(_at_)manuel(_dot_)ca
    ! email1(_at_)host(_dot_)ca

    :0c
    * ^TO_user2(_at_)manuel(_dot_)ca
    ! email2(_at_)host(_dot_)ca

    :0
    * 1^0 ^TO_user1(_at_)manuel(_dot_)ca
    * 1^0 ^TO_user2(_at_)manuel(_dot_)ca
    /dev/null

Copies are checked and possibly forwarded, and then after
all of the potential forwards are taken care of, they are
discarded. That last recipe can be avoided by making DEFAULT
be /dev/null (or some other pit)... but you wouldn't want
to do that unless you KNEW that your recipes were catching
EVERYTHING important.

--
John Patton                      patton66(_at_)home(_dot_)com
Get my GnuPG public key: finger john(_at_)24(_dot_)22(_dot_)215(_dot_)225

"A jury consists of twelve persons chosen to decide who
has the better lawyer."  - Robert Frost
_______________________________________________
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>