procmail
[Top] [All Lists]

Re: How to count "Received:" Header

2005-01-16 15:59:56
On Sun, Jan 16, 2005 at 10:56:48PM +0100, linux4michelle(_at_)freenet(_dot_)de 
wrote:

Can anyone tell me how to count the "Received:" Headers.

I need only a recipe, which move the Message to a special Folder if
there are only 2 "Received:" Header.

Sure.  but the funny thing is, I told you that already on November 8th, 2004.
I guess maybe you weren't paying attention.  Actually, it was (imho, natch)
a very useful message.

Here's the link:

http://www.xray.mpe.mpg.de/mailing-lists/procmail/2004-11/msg00056.html


And here's an excerpt:

-----------------------------------
 OCTET   = "([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"
 DOTQUAD = "$OCTET[.]$OCTET[.]$OCTET[.]$OCTET"

So how about (bear with me about where I have the match token):

  :0
  * $ 1^1 ^Received: from\>\/.*$DOTQUAD\>
  {
       RCVD_COUNT = $=  # lagniappe-city, as long as we're here

       :0
       * $ 9876543210^0  MATCH ?? [[(]\/$DOTQUAD\>
       * $ 9876543210^0  MATCH ?? ()\/$DOTQUAD\>
       * $ MATCH ?? ^^\/$DOTQUAD
       { PUTATIVE_SENDER_IP = $MATCH }
  }


That's all (the initial placement of the match token, and then the last
recipe with an oversaturated max int count) because I would prefer to
trust an IP address that is surrounded by brackets or parens than one
that is naked; but I'll take a naked one over none at all.
-----------------------------------

With that, you have not only your wish ($RCVD_COUNT), but
also the IP address of the putative sender, which previously you
were using sed or formail or something I can no longer remember
to get.


Dallman

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