procmail
[Top] [All Lists]

Re: send notification of mail to another address

2000-10-03 09:16:10
"Jesse C. Chang" wrote:
I want to write a procmail recipe that would notify me by email at, say,
address1, when I receive email from a specific person at address2.  The
notification could be a prewritten file, but it would be nicer if the
Subject: line of the email (from the other person) is appended into the
body of the notification (without permanently altering the prewritten
file, that is).

Here's a starting point.  At address2, put something like this in your 
.procmailrc:

    # if NL isn't already defined
    NL="
    "

    # Edit the condition below to your liking.
    :0 c
    * ^From: *someone(_at_)somewhere
    {

        LOG="mail from someone(_at_)somewhere, sending notification$NL"

        # 'h' to only send the header and 'i' to ignore errors from early
        # closed pipe.  The 'i' is probably not really needed but it's
        # safe. 
        :0 hi
        | (cat /prewritten/file; formail -kXsubject:) | mail address2(_at_)dom2

        LOG="WHOA!  YOU SHOULD NOT GET HERE!!$NL"

        :0
        /dev/null
    }

    # at this point you can continue processing... 

The above is untested...
-- 
Neither I nor my employer will accept any liability for any problems
or consequential loss caused by relying on this information.  Sorry.
Collin Park                         Not a statement of my employer.

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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