procmail
[Top] [All Lists]

Re: Filter von Cc und Bcc

2002-06-05 09:30:52
At 17:58 2002-06-04 +0200, Ahmed Chaabani did say:
hat jemand eine Idee wie man am besten das Filtern von Cc und Bcc einstellen
kann.Ich habe besonders problem wenn die E-mail an verschiedenen Usern die in der CC- b.z.w BCC-liste,eingetragen sind, so daß einer von den usern die
E-Mail doppelt bekommt, und die anderen empfangen keine E-Mail.

Babelfish <http://babelfish.altavista.com/tr> "translates" this to:

Hello cunning, someone has an idea like one best a filtering of CC and Bcc to
adjust kann.Ich has problem if the email at different Usern in the CC b.z.w BCC would particularly list, is registered, so that one of usern gets the E-Mail doubly, and the others do not receive E-Mail.

Sounds like you're using a single user account to manage multiple mailboxes, probably forwarding for users from it.

Procmail is not an MTA.  This is a mantra.

Procmail is provided only the local delivery user as an argument (if being invoked properly from a .forward or as the LDA), so if the multiple recipients are all aliased addresses through one _physical_ user account, you're rather out of luck, because your MTA has resolved the users down to a single account, which is all it is providing to the LDA process - i.e. even though the MTA would know about the multiple recipients at the beginning of the E/SMTP transaction phase, once it has resolved them down to specific physical accounts, that's all it will identify to procmail. Unfortunatley, when messages are addressed to multiple aliases, the common config hacks such as X-Envelope-To: often develop problems.

Procmail is stuck having to use the headers to discern who a message was delivered to - in the case of BCCs though, the BCC'd recipient may not be identified anywhere. Depending upon how the message was delivered, you may receive only ONE message for both users, or you may receive two. If you use the formail message-id cache feature, you might be able to reduce "ghost" messages (provided the two physical messages still have a common messageid), but if you still cannot see the BCC'd address you're going to have delivery separation issues nonetheless.

If you want incoming email which is addressed to multiple users to get to multiple users, you should manage that at the MTA level.

BTW, it often helps if you provide the recipe you're presenty using, as people can point to where you have problems in it.


Here's a kludge (you should also add support for mail loops if you _forward_ email to any of the users at addresses elsewhere):

# Use message-id cache to eliminate duplicates (see 'man procmailex' for
# some cautions about this)
:0 Wh: msgid.lock
| formail -D 8192 msgid.cache

:0
* ^TO_(firstuser|seconduser|lastuser)@thisdomain\.tld
{
        :0c:
        ^TO_firstuser(_at_)thisdomain\(_dot_)tld
        firstusersmailbox

        :0c:
        ^TO_seconduser(_at_)thisdomain\(_dot_)tld
        secondusersmailbox

        #(repeat above as necessary - specifically the 'c' flag)

        # technically, the last checked address could still have a 'c' flag
        # on it, but we omit it on efficiency grounds.
        :0:
        ^TO_lastuser(_at_)thisdomain\(_dot_)tld
        lastusermailbox

        # deliver any slack copy to trash (we'd at a minimum have delivered
        # to the first user and any other _identified_ users above - we
        # intentionally copy the message so that it can continue to be
        # checked, but the _last_ check may not match, so we could end up
        # with an excess copy).
        :0
        /dev/null
}


Note that since procmail isn't an MTA, I don't try to use it like one, so I don't use the above or anything vaguely resembling it. Refer to my disclaimer.

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