Re: [exim] Feature Needed - Main_domain

Top Page
Delete this message
Reply to this message
Author: Alun
Date:  
To: exim-users
Subject: Re: [exim] Feature Needed - Main_domain
Marc Perkel <marc@???> said, in message
432E4B47.9070409@???:

> New revised code at bottom.
>
> If the part second to the end is co com net org then it's 3 part.


Where should news.com.com be split up?
What would you want for www.aber.ac.uk?
How about www.alumni.aber.ac.uk?
Or something.demon.co.uk?

Determining a suitable subdomain is a black art. I tried it a few
years ago for spam reporting (back when it was actually useful to
do such). Best I could do was something like (feel free to criticise!):

function maildomain(name)
{
    domain = ""
    mx = ""


    # Find longest "domain" part which has an MX lookup.
    while (name <> "")
    {
        mx = mx lookup for name
        if (mx <> "")
        {
            domain = name
            break;
        }
        strip first component from name
    }


    # Find shortest "domain" part which has the same MX lookup.
    while (name <> "")
    {
        mx2 = mx lookup for name
        if (mx2 == mx)
        {
            domain = name
        }
        else
        {
            break;
        }
        strip first component from name
    }
    return domain
}


Cheers,
Alun.


-- 
Alun Jones                       auj@???
Systems Support,                 (01970) 62 2494
Information Services,
University of Wales, Aberystwyth