procmail
[Top] [All Lists]

Re: Sending a response depending on domain name

1997-06-07 10:33:00
On Fri, 6 Jun 1997 23:15:31 +0100 (BST),
John T Ellis <ellis(_at_)cork(_dot_)cig(_dot_)mot(_dot_)com> wrote:
     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

I take it the purpose is to send the FILE_A file if mail is from
DOMAIN. This means you should probably put the echo thing in backticks
(not straight quotes) but none of that is really necessary. 

Off top of slightly flat head:

    FILE=$FILE_B

    :0
    * $ ^From:(_dot_)*(_at_)${DOMAIN}\>
    { FILE=$FILE_A }

    :0
    | ( formail -rI"From: $ME" ; sed -e ... ) | $SENDMAIL -oi -t

If you want to expand on the concept (for instance, set FILE only
under certain circumstances, and send a reply only when FILE is set),
that is doable as well; check out the documentation for ?? in the
procmailrc manual page.

Hope this helps,

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

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