[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: formail and procmail question



On Sun, 28 Jul 2002 17:48:19 +0800 Patrick Hsieh <pahud@pahud.net>
wrote:

> I'd like to use procmail to filter some incoming mail and reply to the
> sender with the complete header of the original mail as part of the
> replying mail. I've read the formail man page but can't find any way
> to do that. Is there any solution?

Your question prompted me to finally do something I've been thinking on
and off for some time: set up a mail echo reply on my machine using a
procmail recipe. You can test it by sending mail to echo@vbc.dyndns.org .

It's a similar problem, so I'm including my recipe here, for you to
change to your wishes:

========== begin .procmailrc extract ==========
...
SENDMAIL=/usr/sbin/sendmail   <--------- check your MTA
ECHOTMP=/tmp/echo-reply
...
   # ----- echo reply -----
   :0 Hcw                <--------- ":0 Hbcw" to only include the headers in the reply
   * ^To: echo@.*        <--------- check your specific case (target user)
   | cat > $ECHOTMP

      :0 acw
      * !^FROM_DAEMON
      * !^X-Loop: my@email.address
      | (formail -r \
         -A"X-Loop: my@email.address" \
         -A"X-EchoReply: vbc.dyndns.org" ; \
         echo -e "(THE MESSAGE YOU WANT FOR THE REPLY).\n" ; \
         echo -e "--------------------------------------------------\n" ; \
	 cat $ECHOTMP ) | $SENDMAIL -t
   # ----------------------

========== end .procmailrc extract ==========

See procmailrc(5) and procmailex(5) for more information.

-- 
Carlos Sousa
http://vbc.dyndns.org/


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: