procmail
[Top] [All Lists]

Re: Getting matched text from FROM_DAEON (also tip to avoid FROM_DAEMON)

1998-10-23 05:42:31
|Fri 1998-10-23 era eriksson <era(_at_)iki(_dot_)fi> list.procmail
| 
|     * ()\/^FROM_DAEMON.*

Exactly. Correction to my previous post: It is not the from_daemon case we
want, but not_from_daemon, which is more used:


        o   You can avoid multiple and possible expensive FROM_DAEMON tests
            by cacheing the result at the top of your .procmailrc.

                not_from_daemon = "."

                :0                  # ()\/ just writes the matched text to log
                * ()\/^FROM_DAEMON.*
                {
                    not_from_daemon = "!"
                }

                :0                  # This is how you use the variable a lot
                *$ $not_from_daemon
                {
                    ..this WAS NOT daemon message..
                }

                :0
                *$ ! $not_from_daemon
                {
                    ..this WAS daemon message, funny tahat double negation..
                }


And back to FROM_DAEMON. I received attached mail (domain names changed) to
my mail server and the FROM_DAEMON regexp trapped it with match

    procmail: Assigning "MATCH="
    procmail: Matched "Sender: root(_at_)p166(_dot_)mcnet(_dot_)priv
    Me"

Does FROM_DAEMON need a twist? It seems to match 

    (((Resent-)?(From|Sender)|X-Envelope-From):|>?From )
                      ======
    ..
    |r(e(quest|sponse)|oot)
     =                 ====


jari


I wonder If I deciphered this right...

(^(Precedence:.*(junk|bulk|list)
  |To: Multiple recipients of 
  |(
    ((Resent-)?(From|Sender)|X-Envelope-From):|>?From )
    ([^>]*[^((_dot_)%(_at_)a-z0-9])?
    (
        Post(ma?(st(e?r)?|n)|office)
        |(send)?Mail(er)?
        |daemon
        |m(mdf|ajordomo)
        |n?uucp
        |LIST(SERV|proc)
        |NETSERV
        |o(wner|ps)
        |r(e(quest|sponse)|oot)
        |b(ounce|bs\.smtp)
        |echo
        |mirror
        |s(erv(ices?|er)
        |mtp(error)?|ystem)
        |A(
           dmin(istrator)?
           |MMGR
           |utoanswer
          )
    )
    (  ([^).!:a-z0-9][-_a-z0-9]*)?
       [%@>         ][^<)]*(\(.*\).*)?
    )?
    $
    ([^>]|$)
  )
)




X-From-Line: bar(_at_)foo(_dot_)net  Fri Oct 23 04:18:55 1998
Received: from pobox.com (pobox.com [131.228.118.232]) by mx.pobox.com 
(8.6.4/8.6.4) with ESMTP id EAA03700 for 
<jari(_dot_)aalto(_at_)poboxes(_dot_)com>; Fri, 23 Oct 1998 04:18:54 +0300
Received: from out4.foo.net (out4.foo.net [165.87.194.239]) by pobox.com 
(8.8.5/8.6.9) with ESMTP id EAA05037 for 
<jari(_dot_)aalto(_at_)poboxes(_dot_)com>; Fri, 23 Oct 1998 04:11:12 +0300 (EET 
DST)
Received: from p166.mcnet.priv 
(root(_at_)slip139-92-8-26(_dot_)fr(_dot_)de(_dot_)foo(_dot_)net [139.92.8.26]) 
by out4.foo.net (8.8.5/8.6.9) with ESMTP id BAA71788 for 
<jari(_dot_)aalto(_at_)poboxes(_dot_)com>; Fri, 23 Oct 1998 01:11:25 GMT
Received: from foo.net (root(_at_)p166(_dot_)mcnet(_dot_)priv [192.168.1.100])
        by p166.mcnet.priv (8.8.8/8.8.8) with ESMTP id LAA01236
        for <jari(_dot_)aalto(_at_)poboxes(_dot_)com>; Thu, 22 Oct 1998 
11:51:39 +0200
Sender: root(_at_)p166(_dot_)mcnet(_dot_)priv
Message-ID: <362F002B(_dot_)A457BFBE(_at_)foo(_dot_)net>
Date: 1 day, 1 hour -- 1998-10-22 12:51 Thu EETDST
From: Foo Bar <cordier(_at_)foo(_dot_)net>
X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.35 i586)
MIME-Version: 1.0
To: jari(_dot_)aalto(_at_)poboxes(_dot_)com
Subject: send pm-tips.txt
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 2