procmail
[Top] [All Lists]

Sending a response depending on domain name

1997-06-07 05:48:00
To all,

I'm attempting to build a recipe that will send an automatic response
message depending on what domain the incoming mail originates from.  Before
sending out the file though, I will replace a key word in the file with a
new phrase.  The logic is:

        DOMAIN=some.domain.name
        PHRASE='this is the new phrase'
        ME='ellis(_at_)cig(_dot_)mot(_dot_)com'
        FILE_A=/directory/fileA
        FILE_B=/directory/fileB

        if mail from DOMAIN then {
           FILE='echo $FILE_A'
        }
        else {
           FILE='echo $FILE_B'
        }

        formail -rI"From: $ME"; \
        sed -e "s~\$OLDPHRASE~$PHRASE~" $FILE \
          | sendmail -oi -t

The files fileA and fileB have the key word '$OLDPHRASE' embedded in them.
I want to replace this token with the contents of the $PHRASE.

My questions are:

1) How can I do the if-then-else structure?
2) Does my formail statement make sense?
3) Is there a better way of doing this?

In order to give credit where credit is due, those of you who read this
list religiously will notice that the logic above is very similar to what
Alan Stebbens uses in his ackmail recipe.

Thanks for any and all assistance.

jte

------------------------------+-------------------------------------------------
  John Ellis +353-21-511-487  | To YOU I'm an atheist;
  Motorola Cellular - Cork    |    To GOD I'm the Loyal Opposition.
  ellis(_at_)cig(_dot_)mot(_dot_)com           |                     -- Woody 
Allen 

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