procmail
[Top] [All Lists]

Re: Flag to deliver autoresponse to the CC or BCC

1997-08-22 11:51:15
Era Eriksson suggested to Jeff Halper,

| If you don't like the idea of running two copies of formail just to
| find the Cc: address if there is one (which is dangerous when there
| isn't one), you might want to write your own script.

If this is occurring within a procmail rcfile (in contrast, say, to doing it
in a shell script), you don't need two formail forks, because procmail can
extract the carbonees' addresses.

[In all filtering recipes below, the `h' flag might be appropriate, and in
 any formail command below, the -k option might be needed.  I do not know
 the details of Jeff's situation.]

For example,

     :0fw
     * ^Cc\/:.*[^       ].*
     | formail -r -I "To$MATCH" # -t would make no difference
      :0Efw
      | formail -rt

Although there are two formail filters listed there, they're in an else
relation, and only one or the other can get invoked on any given message.
If that upsets somebody, ok, here it is with only one mention of formail:

  MATCH # make sure it goes in unset

  :0
  * ^Cc\/:.*[^  ].*
  { }
  :0fw
  | formail -rt ${MATCH:+-I "To$MATCH"}

| A third
| alternative might be to play around with renaming the original From:
| field so that formail -rt will prefer Cc: over whatever the original
| From: gets renamed to, but still find it if there is no Cc:
| (unfortunately, you have to look at the source to find out how formail
| prioritizes the various possible sender address fields).

Cc: and To: aren't even listed there; formail -r and formail -rt ignore
them.  Offhand, I remember the header lines that get considered [in order
of my thinking of them; this is not an indication of their precedence!] as
(Resent-)Reply-To:, (Resent-)From:, (Resent-)Sender:, Return-Path:, From_,
and Return-Receipt-To:.  Errors-To: isn't in there either as I recall.  So
renaming From: to put it below Cc: is impossible; you'd have to rename Cc:
to something that outranks From:.

Again, if this is done inside a procmail rcfile, one can overcome the
built-in precedences of formail and formail -rt and set one's own rankings.

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