procmail
[Top] [All Lists]

Re: multiple messages

1997-05-23 06:19:00
At 11:13 AM 5/22/97 +0000, Daniel C. Konnoff wrote:
Hello

      I'm having some configuration file problems. Please excuse
      me if this question has been answered but I was unable to
      find a FAQ or man page solution. Take a look at our .procmailrc
      file please:

[snip]

:0 c:
* ^CC.*daniel
/var/spool/mail/daniel

:0 c:
* ^TOdaniel
/var/spool/mail/daniel

[snip]

      What we want is for any mail addressed to or cc'd to the users to get
      delivered. Without the :0 c procmail stops processing after the first
      match, with :0 c multiple copies of the same message are delivered to
      each user.

The c flag is correct.

However, the ^TO macro includes the Cc: header, so you are matching that twice
and indeed will get two copies filed.  Just omit the recipes with ^CC in them.

For a bit more robustness, you might check for
        * ^TOdaniel(_at_)(_dot_)*your-domain(_dot_)com

since otherwise you're going to incorrectly match mail sent:
        To: someone-else(_at_)your-domain(_dot_)com
        Cc: daniel(_at_)somewhere-else(_dot_)com

(And, of course, as has been discussed on this list many times,
you won't be able to handle Bcc: messages or mailing lists
in this manner, since the recipient will not normally appear in any
of the RFC822 headers.)

Cheers,
Stan

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