procmail
[Top] [All Lists]

Re: Envelope fields from body

1999-04-26 21:06:59
msvd(_at_)mscc(_dot_)huji(_dot_)ac(_dot_)il writes:
Here is short description of the project, I'd like to realize
via procmail.


    ------------    send           ----------------
    | Anyone ONE | ----------->    |   Anyone TWO | <-------|
    -------------    letter 1      -----------------        |
          ^                      letter2  | send            | letter 3
          |                               | via             |confirmation
          |                               | Re or Fw        |
          |                               |                 |
          |                              \|/                |
          |                          -----------------      |
          |                          | Autoresponder |------|
          |                          -----------------
          |    letter 4                   |
          <--------------------------------
               4 Send something from TWO


 Here is my question. Is there correct way to take right address "Anyone
ONE" from letter2 by procmail?
May be it is stupid question, but this address should be into body of
letter2 and I don't understand how take an envelope fields from body of
letter. 

If it's a proper forward, the command

        formail -dm 4 +1 -1 -rtxTo: -s

(or more clearly)

        formail -d -m 4 +1 -1 -r -t -xTo: -s

may work.  If that doesn't, you would probably have to write your own
address extractor in your favorite language, in which case, good luck!

(What do all those options do?  Well, they fall into three groups.  The
 -s option tell formail that it should split the message up.  Since
 there's nothing after the -s, it'll just concatenate the resulting
 output.  The "-dm 4 +1 -1" control how formail does the splitting:
 the -d tells formail that it shouldn't just split on mailbox
 boundaries but look for embedded headers to also split on; the "-m 4"
 tells formail to require at least four good header before considering
 this a possible split point (helps reduce the number of bad splits);
 the "+1 -1" tell formail to skip the first message split out (which
 will be the actual message header) and to actually process only one
 message (so that if you forward two messages only the first will be
 considered).  The last group, "-rtxTo:", tells formail that for each
 split out message (as selected by the previous group of options), it
 should generate a reply, trusting the sender (this should always be
 done), and then extract the value of the resulting "To:" header.
 Cool, eh?)


Philip Guenther

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