procmail
[Top] [All Lists]

Re: Formula question . . .

1999-04-15 07:16:24
On Wed, 14 Apr 1999 18:34:17 -0500,
:0 Whc: notify.lock
* ^To:.(*jmleveron*|*john\@(soon|kosher).com)
* !^FROM_DAEMON
* !^X-Loop: webmaster\(_at_)glock(_dot_)missouri(_dot_)edu
| formail -rD 8192 notify.cache

The first condition contains several errors. "*" is a regex operator
which means "the previous regular expression zero or more times". It
looks like you are confusing this with the glob expressions. The
regular expression way to say "anything at all, or nothing" is .*
(dot, star). (And what's that lone dot after To:?)

Anyway, in this case, you are probably looking for ^TO_ which will
find matches in other relevant headers such as Cc: and Resent-To: as
well. (It's still not perfect. See the FAQ for a discussion.)

    :0 Whc:notify.lock   # also note regex fix in X-Loop check
    * ^TO_(jmleveron|john@(soon|kosher)\.com)
    * ! ^FROM_DAEMON
    * ! ^X-Loop: webmaster(_at_)glock\(_dot_)missouri\(_dot_)edu
    | formail -rD 8192 notify.cache

Other than that, fine so far.

  :0 ehc         # if the name was not in the cache
    | (formail -rA"Precedence: junk" \
       -A"X-Loop: webmaster(_at_)glock(_dot_)missouri(_dot_)edu" ; \
     echo -e "\nHi!\n\n    The mail you sent me was sent to an old
email address.  Please update your records"; \
     echo -e "to show my new address :  
webmaster(_at_)glock(_dot_)missouri(_dot_)edu
\n\r\n\r";
    ) | $SENDMAIL -oi -t
    Old

Yes, for the last part "Old", I'd like them to go into a separate
folder.

Every action must have an equal and opposite ... no, wait: every
action must have a "prelude line", i.e. you need a :0: line as part of
the recipe that saves to Old.

Other than that, I'd merely be worried about readability. Try this
(saves an echo, too):

    :0 ehc   # if the name was not in the cache
    | ( formail -r -A "Precedence: junk" \
                   -A "X-Loop: webmaster(_at_)glock(_dot_)missouri(_dot_)edu" ; 
\
        echo -e  "\n\n   " \
            "The mail you sent me was to an old email address.\n   " \
            "Please update your records to show my new address:\n   " \
            "webmaster(_at_)glock(_dot_)missouri(_dot_)edu\n\n\n" ) | $SENDMAIL 
-oi -t

    :0:
    Old

I'm assuming your echo can cope with this; even if not, it's probably
not too hard to find something that works and doesn't wrap wildly.

/* era */

Oh, in case you missed the latest FAQ announcement:
<http://www.iki.fi/era/procmail/mini-faq.html>

(You seem to have been exposed to Perl CGI scripts for too long. :-)

-- 
.obBotBait: It shouldn't even matter whether     <http://www.iki.fi/era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>
 * Sign the European spam petition! <http://www.politik-digital.de/spam/en/> *

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