procmail
[Top] [All Lists]

Re: Multiple Users with one login

2002-02-28 21:33:01
At 18:17 2002-02-28 -0800, chris did say:
I got it work with the following setup. At least it passed all the tests I
put to it. I am sure there is a way to simplify it, not to mention I have to
add a new ruleset for each To: I plan to filter. I need to add some loop
checks, etc...

Tell me, how well does it work for:

To: email1(_at_)domain(_dot_)com, email2(_at_)domain(_dot_)com

Bcc: email2(_at_)domain(_dot_)com

To: email2(_at_)domain(_dot_)com
Cc: email1(_at_)domain(_dot_)com

To: somemailinglist
Cc: email2(_at_)domain(_dot_)com

etc ?

I am glad to just get it working.

If you say so.


Your indentation (or lack thereof, though perhaps it was brought on by your mailer?) makes it rather difficult to follow your ruleset here, and I don't follow why you use:

        :0
        {
                :0
                * somecondition
                mailbox
        }

(which, just FTR, lacks LOCKING on the delivery to the mailbox)

Rather than:

        :0:
        * somecondition
        mailbox

# FIRST RULE
:0
* ^To: (_dot_)email1(_at_)mydomain(_dot_)net

Please explain the dot before the address?

Why not use:

* ^TO_email1(_at_)mydomain\(_dot_)net

(which handily catches TO/CC/BCC)

Or, if you must use the ^To: expression (instead of the ^TO_ macro), try:

* ^To:.*\<email1(_at_)mydomain\(_dot_)net

(see the various procmail manpages about the syntax)

> If I get an email, for example, that is To:email1 Cc:email2 it doesnt seem
> to filter it out properly.

Procmail isn't an MTA - if you want to deliver to multiple mailbox files, you really should consider doing it from your MTA - say, using aliases.

> it might skip the Cc it has for email2.  I might also get a copy(or two)
in
> the sort box. *scratches his head* Where can I find some good examples of
> what I am trying to do here?

Uhm, the sendmail alias documentation?


If you *MUST* accomplish it in procmail, you might try:

# handle ONLY those messages we determine were delivered to one of these
# specific addresses.  See my disclaimer.
:0
* 
^TO_(email1(_at_)domain\(_dot_)tld|email2(_at_)domain\(_dot_)tld|email3(_at_)domain\(_dot_)tld)
{
        :0c:
        ^TO_email1(_at_)domain\(_dot_)tld
        email1

        :0c:
        ^TO_email2(_at_)domain\(_dot_)tld
        email2

        :0:
        ^TO_email3(_at_)domain\(_dot_)tld
        email3

        # copy we might still have because say, it was addressed
        # to email1 & email2, but not email3.  Discard.
        :0
        /dev/null
}

# if you get here, it wasn't addressed to any of the magical addresses,
# and so you can deliver it normally.  Note that if it was addressed to
# one of the magical addresses *AND* some other addres you receive at this
# account, you'll never arrive here (unless you're receiving multiple copies
# and the magical address was a Bcc).

:0:
sort



Bummer for you if you RECEIVE multiple copies of the physical messages - you can work around that by using a messageid cache (see 'man formail' and 'man procmailex'), but you'll always be iffy at best with your Bcc's, because the only time you have a prayer of identifying one of the addresses as a Bcc recipient is when you have a SEPARATE message received for that individual user.

 Maybe, what I am trying to do is all wrong?

I'd agree with that prospect. What you're trying to accomplish is something which procmail isn't intended for - this is a job intended for an MTA.

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

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