On Mon, 23 Feb 1998 12:40:32 +0200, Mika Perttula
<Mika(_dot_)Perttula(_at_)hut(_dot_)fi> wrote:
I would like construct procmail recipe, which extracts the other party
email-address from the body of the message and sends auto-response
message to that address. Can you help me on this? Please answer
privately too (Mika(_dot_)Perttula(_at_)hut(_dot_)fi).
From the +body+? Like this you mean? This assumes that the very first
line of the message should contain the string "Body-Reply-To: (reply
address)" -- if this is not desired then perhaps you can describe more
exactly how you hope to know which part of the body to extract the
reply address from.
    :0ciw
    * B ?? ^^Body-Reply-To:[    ]*\/[^  ].*
    | echo "To: $MATCH\
\
From: Runaway Responder <nobody(_at_)hut(_dot_)fi>\
\
\
Your message was received and forwarded as appropriate. \
\
Thanks for participating. Don't reply to this message. Thanks." | \
    $SENDMAIL $SENDMAILFLAGS -t
The backslashitis required to produce the wanted output is certainly
not something for the weak of stomach. Procmail's backslash parsing is
a huge crock. The above example will produce the following output:
    To: (whatever ended up in $MATCH)
    From: Runaway Responder <nobody(_at_)hut(_dot_)fi>
    Your message was received and forwarded as appropriate. 
    Thanks for participating. Don't reply to this message. Thanks.
I'd normally use multiple echo's, I just wanted to show that it can be
done with only one.
If you just want a normal autoresponder, the procmailex(5) manual page
has some suitable-looking exanples.
Hope this helps,
/* era */
One idea would be to use "auxiliary headers", like news.answers FAQs
and most anon servers. Like this:
    From: you really
    Message-Id: <moo(_at_)bar(_dot_)baz(_dot_)quux>
    To: anon server
    Really-To: final destination
    Real-Subject: subject
    Real body ...
You can extract these headers in a couple of interesting ways. The
above recipe could be amended to look for the desired header in any of
the first cluster of lines before the first empty line:
    * ^^(^.$)*Body-reply-to:[   ]*\/[^  ].*
Or you could simply ditch the real headers and by happy coincidence
have the auxiliary headers "promoted" to be the new headers of the
message: 
    :0fhi
    | /bin/true  # just discard original headers
... and then operate on that.
-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>