procmail
[Top] [All Lists]

Re: dynamci filters

2008-07-30 19:29:55
At 15:39 2008-07-30 -0700, George Crum wrote:

1. All emails are forwarded to email-address1.

Well, by rule #2, it sounds like those messages wouldn't always be.

2. Receive email with "Subject: PROBLEM ..." for the first time, forward to email-address1. Any consecutive times afterwards I want to forward the email to email-address2.

Er, please define "consecutive times afterwards". How do you define the first time you receive a message? Or is this ANY time a "PROBLEM" message arrives?

Follows is a rough draft of something that would probable accomplish something like what you're describing, but some stuff is vague, so perhaps this is the wrong approach. Also, there are some lockfiles which could be implemented to eliminate concurrent messages getting handled awkwardly.


PROBLEMFILE=$HOME/somefile

:0
* ^Subject: PROBLEM
{
        :0
        * ? test -e $PROBLEMFILE
        ! email-address2

        :0ic
        | touch $PROBLEMFILE

        :0
        ! email-address1
}

# note here, we don't forward it, we just eliminate the file that causes
# PROBLEM messages to be directed elsewhere.
:0ic
* ^Subject: RECOVERY
| rm $PROBLEMFILE

# default delivery for everything, per your message.  This includes the above
# recovery message and the fall-through from the PROBLEM message.
:0
! email-address1


3. When email with "Subject: RECOVERY..." is received I want the email to go to email-address1 and change the filter for "Subject: PROBLEM ..." back to forwading to email-address1.

Is there some unique identifier after the beginning of the subject, such as a incident number? What if you receive a RECOVERY message and no PROBLEM message?

Is this possible with procmail?

Certainly should be, but you need to define the actual logic flow better.

Lay out a flowchart - what happens to each individual message under what circumstances. Worry less about the actual _how_ to accomplish certain bits, and just lay out the what is supposed to happen or not happen.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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