procmail
[Top] [All Lists]

how to archive mail to a file _and_ write an automated mail back ?

1999-06-12 09:15:37
Hi !

For apsfilter developement I need the following functionality that
procmail could give me, but I don't get the syntax right:

I want to filter mail to apsfilter-promo, to perform the following tasks:

        - write a copy of the mail into a file within my source
          directory called SATISFIED_CUSTOMERS

        - write automatically a mail back to the sender, telling him,
          that I'd like to get a postcard from him and telling him my
          smail mail address.

The vacation example in procmailrc gave me a good start.
But somehow it doesn't work. Currently only the first receipt
works properly, that I get the incoming mail into the special
folder, but then instead generating a reply header and sending
my automated mail to the user back, I get a copy of the original
mail into my incoming mail folder...

Would be nice if you could give me some advice

This works, so that the customer becomes the mail back with
my postal address. But I want additionally a copy of the
original mail from the customer to a mail folder ....

:0 Whc: apsfilter-promo.lock
 # perform a quick check to see if the mail was addressed to us
* $^To:(_dot_)*apsfilter-promo(_at_)klemm(_dot_)gtn(_dot_)com(_dot_)*
 # Don't reply to daemons and mailinglists
* !^FROM_DAEMON
 # Mail loops are evil
* !^X-Loop: andreas(_at_)klemm(_dot_)gtn(_dot_)com
| formail -rD 8192 apsfilter-promo.cache

        :0 ehc  # if the name was not in the cache
        | (formail -rA"Precedence: junk" \
                -A"X-Loop: andreas(_at_)klemm(_dot_)gtn(_dot_)com" ; \
        echo "Thanks for using apsfilter and writing this promo mail."; \
        echo ""; \
        echo "If you want to do me a favour, then please write"; \
        echo "me a postcard, yes I want postcards ;-) My address:"; \
        echo ""; \
        echo "      Andreas Klemm"; \
        echo "      Am Sandhof 15"; \
        echo "      D-41469 Neuss"; \
        echo "      Germany"; \
        echo "-- "; cat $HOME/.signature \
) | $SENDMAIL -oi -t                              

This is how I tried to implement it, but I only get an entry
in the mailfolder $HOME/src/mysrc/apsfilter/SATISFIED_CUSTOMERS
and a copy of that mail into my incoming folder...

:0 Whc: apsfilter-promo.lock
 # perform a quick check to see if the mail was addressed to us
* $^To:(_dot_)*apsfilter-promo(_at_)klemm(_dot_)gtn(_dot_)com(_dot_)*
 # Don't reply to daemons and mailinglists
* !^FROM_DAEMON
 # Mail loops are evil
* !^X-Loop: andreas(_at_)klemm(_dot_)gtn(_dot_)com
{
        # save a copy of this mail in the SATISFIED_CUSTOMERS file
        :0 c
        $HOME/src/mysrc/apsfilter/SATISFIED_CUSTOMERS

        :0
        # further process the carbon copy of the delivery receipe
        # send my automatic reply mail to the customer ...
        | formail -rD 8192 apsfilter-promo.cache
                :0 ehc  # if the name was not in the cache
                | (formail -rA"Precedence: junk" \
                     -A"X-Loop: andreas(_at_)klemm(_dot_)gtn(_dot_)com" ; \
            echo "Thanks for using apsfilter and writing this promo mail."; \
            echo ""; \
            echo "If you want to do me a favour, then please write"; \
            echo "me a postcard, yes I want postcards ;-) My address:"; \
            echo ""; \
            echo "      Andreas Klemm"; \
            echo "      Am Sandhof 15"; \
            echo "      D-41469 Neuss"; \
            echo "      Germany"; \
            echo ""; \
            echo "-- "; cat $HOME/.signature \
        ) | $SENDMAIL -oi -t
}

-- 
Andreas Klemm                               http://www.FreeBSD.ORG/~andreas
                                  http://www.freebsd.org/~fsmp/SMP/SMP.html
                                powered by Symmetric MultiProcessor FreeBSD

<Prev in Thread] Current Thread [Next in Thread>
  • how to archive mail to a file _and_ write an automated mail back ?, Andreas Klemm <=