procmail
[Top] [All Lists]

Re: Autoresponse to an address found in the BODY

1999-03-12 12:43:16
Excerpts from mail: (12-Mar-99) Autoresponse to an address found in the BODY by 
jeff halper
I'm struggling with trying to make Procmail do the following: Inside
the body of each email message I receive at a certain mailbox is a line
reading

email: somebody(_at_)someplace(_dot_)com

The mail comes from a cgi program from a shopping cart.

I want to return an auto-response to the email address in this line -
something like "Thank you for your order".

You need to do a body search and use MATCH to grab the address. The following
is untested, but I hope it is useful to you.

:0
*   ^TO_autoresponder
* ! ^FROM_DAEMON
* ! ^X-Loop: autoresponder(_at_)yourdomain\(_dot_)com
* B ?? ^email:[         ]*\/[^  ].*
{
    EMAILRECEIPT = $MATCH

    :0
    | (formail -rt -A "Precedence: junk" \
               -I"To: $EMAILRECEIPT" \
               -I"From: Auto Reply from domain.com 
<autoresponder(_at_)domain(_dot_)com>" \
               -I"Subject: Order Received at domain.com" \
               -A "X-Loop: autoresponder(_at_)domain(_dot_)com"; \
       echo "Thank you for your order."; \
       echo ""; \
       echo "The management of domain.com"; \
      ) | $SENDMAIL -oi -t
}

Inside the first square bracket expression is a space and a tab. Inside the
second square bracket expression is a caret, a space, and a tab.

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