Marc Perkel <[EMAIL PROTECTED]> said, in message
[EMAIL PROTECTED]:

> 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                       [EMAIL PROTECTED]
Systems Support,                 (01970) 62 2494
Information Services,
University of Wales, Aberystwyth

-- 
## List details at http://www.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://www.exim.org/eximwiki/

Reply via email to