Re: Special auto replies


Subject: Re: Special auto replies
art-ydl-general@pigdogs.org
Date: Mon Aug 27 2001 - 21:12:18 MDT


   Subject: Special auto replies
   From: Rob Brandt (rbrandt@sbdsl.com)
   Date: Mon Aug 27 2001 - 13:40:09 MDT

   I have a situation coming up where I will be expecting emails from
   specific customers that contain specific text strings - reference
   numbers. I need to be able to have a specific email reply to them
   immediately. No two mails sent to me will be alike, and each mail
   will have it's own auto reply. I will of course know in advance what
   emails will be coming, and and what emails will be going, but I don't
   know the day and the time, and the responses need to be sent
   immediately.

   Is there a beast that can handle this?

procmail will do it for you, though you'll need to learn a bit
about procmail in the process. It should be part of your
installation; try `man procmail' and `man procmailrc'. It's wildly
powerful and hideously arcane.

The basic recipe is something like:

 :0 B
 * <one expected reference number>
 * !^FROM_DAEMON
 * !^X-Loop: your@mail.address
 | (formail -A"X-Loop: your@mail.address" ; \
    cat $HOME/<one expected autoreply> ) | $SENDMAIL -oi -t

This will check to see if the incoming message is from a mailer daemon
(maybe a bounced message), whether it contains an x-loop header
indicating that it came from you (in case one of your customers is
autoreplying back to you; mail loops are the most significant thing
you're going to have to worry about with your scheme), and if it
wasn't, it then scans the body for a particular reference number. If
that particular reference number is present, it adds an x-loop:
header, generates the rest of the autoreply header (see `man formail'
for more info) and sends as the message body the contents of <one
expected autoreply>. (I think. I'm just typing this, not testing it.)

You need to make one of these recipes for each reference number.

If you're already delivering mail on your machine, and if you're using
linux, then procmail is installed as the default mail delivery agent,
and all you need to do is put these recipes in your home directory in
.procmailrc.

Remember to test this a =lot= before deploying it, since so much can
(and always does) go wrong.

--art



This archive was generated by hypermail 2a24 : Mon Aug 27 2001 - 20:20:39 MDT