procmail
[Top] [All Lists]

Re: Get domain and tld ?

2009-01-25 08:46:40
PSE-L(_at_)mail(_dot_)professional(_dot_)org (Professional Software Engineering)
writes:

At 01:35 2009-01-25 +0100, Xavier Maillard wrote:
I am struggling with something really simple: have multiple
"match" from a single rule.

Keep struggling.  You need a series for rules.

You are right.

I want to get both tld and *last* part of the domain for any
processed email.

From where?  A From: header, a Received line, a To:, what?

In fact, I thought I would take the Return-Path but after having
analyzed different "target" messages, it won't work. So I need to
find the most useful header for that.

The idea behing my request is to write a rule for domains I am
both subscribed to their numerous mailing-list and where I am
also a moderator.

Currently, this is the closer rule I have found:

:0: gnu.lock
* ^TO_ ()\/[^(_at_)]+@gnu.
* MATCH ?? ()\/[^(_at_)]+
{
  FALLBACK=$MATCH
  
  :0 
  * FALLBACK ?? (.*-admin|.*-owner)
  {
     :0:
     * ^Subject:[       ]*(\<approval\>|\<approbation\>)
     | $RCVSTORE +sys/moderate/org/gnu   

     :0:
     | $RCVSTORE +inbox
  }

  :0
  * ^((List-Id|X-(Mailing-)?List:):(.*[<]\/[^>]*))
  {
    LISTID=$MATCH

    :0:
    * LISTID ?? ^\/[^(_at_)\(_dot_)]*
    | $RCVSTORE +lists/org/gnu/$MATCH
   }

   :0:
   * DESTINATION ?? (zedek|xavier|xma)
   | $RCVSTORE +inbox
   
}

I want this rule to apply for gnu.org, lolica.org and several
other domains. TLD, DOMAIN and LIST would then be used to sort
mails in a TLD/DOMAIN/LIST hierarchy.

# first, match the domain down to JUST the rightmost two domain tokens
# (i.e. remove the optional hostname levels).  As parsed here, I'm allowing
# for the FROMDOMAIN to actually be an email address - this will still work.

Pretty impressive !

BTW, you do realize that outside of the country-generic TLDs such as
.com, .org, .net, .biz, etc, that some country specific TLDs often
have their own secondary heirarchy.  For example:

        host.demon.co.uk

Ooops, I did not think about this case :/

I must wonder, is this an extension of trying to sort list mail
automatically?  Have you seen the listname_id.rc ruleset?  Search the
archives.

I read it but I can't find any "application" for my case. I
really need/want something along this:

lists/tld/domain/list

I would really be thankful if somebody would explain the
listname_id.rc line by line :)

Regards

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