procmail
[Top] [All Lists]

Re: Help with recipe using scoring

2005-02-25 11:53:14
At 10:21 2005-02-25 -0500, S.A. Birl wrote:
[snip]
So ... that's what I get for throwing everything to $ORGMAIL.

... or not examining the verbose logs fully. If you're throwing test messages at the recipes in a sandbox, you should just enable verbose right off at the top, so you can see EVERYTHING. Verbosity in a sandbox isn't a liability like verbosity on your live mail spool can be.

But now Im wondering if it's better to set 'c' in the outer nest or in the
inner nest.  I think if I put it in the outer (like below) every incoming
email will be copied?

Generally, put the 'c' flag at the level where a message will actually be delivered. An exception is if you're going to filter the message and want to do that operation on a copy of the message and then follow up with a delivery, and then a condition construct at the level above that is a good place to put the copy flag.

VERBOSE=ON
:0 c
* ^Subject:.*Powerball
* B ?? with an estimated Grand Prize of \$\/[^ ]+
{
        Jackpot=`echo $MATCH | sed 's/,//g'`

What follows is simply an optimization of the above recipe, assuming the jackpot is formatted as $xxx,xxx,xxx. It has NOTHING to do with your (now resolved) misinterpretation of delivery. I'm only offering it as a different way of looking at the match construct which involves less (well, no) external processing.

While it wouldn't be a strictly foolproof way of doing the match, is this lottery ever BELOW one million or ABOVE 999 million? I'm sort of doubting it, in which case, you could simply match to the first comma, and eliminate the sed operation, and operate in units of a million:

# If the Jackpot is over $95 Million, send directly to INBOX
:0
* ^Subject:.*Powerball
* B ?? with an estimated Grand Prize of \$\/[^,]+
{
        LOG="procmail: Powerball jackpot is \$${MATCH} Million${NL}"
        :0c:
        * -95^0
        * $ $Jackpot^0
        $ORGMAIL
}

Potential failings include changes to the syntax of the notification message (which would likely affect your original match anyway, with the exception of removal of the commas, which would make this tweak think you had a seriously huge jackpot, but would leave your original recipe unaffected), and of course a jackpot at a billion or more, or less than a million (where the first sequence of digits before a comma would be thousands rather than millions).


Why do you even want a COPY of the notification floating around anyway? If you're delivering it directly to your inbox, what else to you plan to do with the original, which will continue on past this recipe?

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