procmail
[Top] [All Lists]

Re: recipe not being honored.

2008-06-30 09:53:32
At 16:55 2008-06-30 +0100, N.J. Mann wrote:
In message 
<Pine(_dot_)GSO(_dot_)4(_dot_)33(_dot_)0806301011230(_dot_)18992-100000(_at_)rushmail(_dot_)cc1(_dot_)rpslmc(_dot_)edu>,
        Christpher Barnard (cbarnard(_at_)rush(_dot_)edu) wrote:
>
> I think I need another set of eyes.  I have not found the solution in the
> archives, but I'm not sure what I am doing wrong so I do not know what to
> search for.
[...]
>
> The rule:
>
> :0:
> * ^To:(_dot_)root(_at_)dmznb-b(_dot_)dmzbbus(_dot_)rpslmc(_dot_)edu
> * ^Subject:.Backup
> * succeeded
> /opt/home/cbarnard/mail/backups

:0:
* ^To:(_dot_)root(_at_)dmznb-b(_dot_)dmzbbus(_dot_)rpslmc(_dot_)edu
* ^Subject:.Backup
* B ?? succeeded
/opt/home/cbarnard/mail/backups

Nick Mann's approach is basically what I would have posted, though with some syntactical corrections. The other examples, while correct, don't really need to be using a braced recipe level - which I find is best used for multiple sub-recipes which depend upon common conditions, or a sequence of dependant actions.

:0:
* ^To:[         ]*root(_at_)dmznb-b\(_dot_)dmzbbus\(_dot_)rpslmc\(_dot_)edu
* ^Subject:[    ]*Backup
* B ?? succeeded
/opt/home/cbarnard/mail/backups

Dots that should be interpreted as dots, rather than as a single character wildcard, should be escaped. Brackets enclose a space and a tab.

Why not add a ^From: condition?

Note also that the body check is performed after the header checks. All examples, even yours were ordered in this way, but as long as the crux of your problem was the difference between matching the headers vs. the body, I thought I'd point out that since the headers tend to be smaller (esp in messages with attachments), searching the headers (To and Subject in this case) first allows a failure to match the conditions to abort the recipe before you take the potentially significant hit for string searching an email which may have attachments: EVERY message checked against the recipe would be checked, whether the string was found or not.

Anyway, all is okay with the order, just thought I'd point out that the order IS significant from a performance standpoint.

---
 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>