procmail
[Top] [All Lists]

Re: Handling of CC?

1996-12-09 02:35:43
  > I have been trying to come up a simple rc which handles CC (or Cc:)
  > without much success.
  > 
  > The egrep parser in procmail does just one pass, and if there is a Cc:
  > line in the header of the incoming message, the recipients listed on
  > that line won't get anything, as most likely the To: line is above the
  > Cc: line so it gets matched first.
  > 
  > For instance, if an incoming message has the following 
  > 
  > Date:  Wed, 4 Dec 1996 22:23:28 -0800 (PST)
  > To: fangchin(_at_)jessica(_dot_)stanford(_dot_)edu
  > cc: 
mwang(_at_)rescomp(_dot_)stanford(_dot_)edu,doh(_at_)cyclone(_dot_)stanford(_dot_)edu
  > 
  > and if the rc file has 
  > 
  > :0
  > * TOfangchin
  > ! chin(_at_)ruca(_dot_)ua(_dot_)ac(_dot_)be
  > 
  > then only I will be getting the message, the two poor guys Mark and
  > Doh won't have anything :(
  >
  > I can come up a ugly Perl script to do the extra Cc line processing
  > (basically looping thru all listed recipients in that line, and pump
  > the body of the incoming message to each listed person), but am
  > wondering whether I can use procmail's built-in commands to achieve
  > the Cc: line processing as well?

First, if you want to match a Cc: header by itself, just do so:

  :0
  * ^Cc: whomever(_at_)wherever
  <someaction>

Second, if you wish to match for multiple recipients, place multiple
recipes:

  :0c
  * ^TOfanchin
  ! chin(_at_)ruca(_dot_)ua(_dot_)ac(_dot_)be
  :0c
  * ^TOmwang
  ! mwang(_at_)wherever
  :0c
  * ^TOdoh
  ! doh(_at_)wherever

Third, I like to know what's happened to my mail, so whenever one
of my recipes does something "on the side" to my mail, I mark it.

So, here is a recipe which accumulates fowarding addresses, 
forwards a copy to these addresses, and then marks the mail (for me)
with a header indicating who received a copy.

  FWDS
  :0c
  * ^TOfanchin
  { FWDS="$FWDS chin(_at_)ruca(_dot_)ua(_dot_)ac(_dot_)be" }
  :0c
  * ^TOmwang
  { FWDS="$FWDS mwang(_at_)wherever" }
  :0c
  * ^TOdoh
  { FWDS="$FWDS doh(_at_)wherever" }
  :0
  * FWDS ?? .
  {  :0c        # forward a copy of the mail
     ! $FWDS
     :0fh       # and tell me about it
     | formail -I"Forwarded: $FWDS"
  }

Fourth: why are you forwarding mail which has already been addressed,
and independently distributed to other addresses?  If their addresses
are working, they'll receive the original mail at their "stanford.edu"
address, and another at wherever you send it.  If these people are
reading their email from another address, then *they* should be
arranging the forwarding, not you.  Most people, even friends, do
not appreciate someone doubling the time spent reading mail
messages.

G'luck.

___________________________________________________________
Alan Stebbens <aks(_at_)sgi(_dot_)com>      http://reality.sgi.com/aks

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