Re: Re: get domain component from email

From: Date: Tue, 07 Aug 2007 22:59:06 +0000
Subject: Re: Re: get domain component from email
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-260348@lists.php.net to get a copy of this message
way to do so by using dns records. It's like 5 lines, here's the site http://www.sitepoint.com/article/users-email-address-php
The requirement for email delivery is not MX, just having an A address is enough. Also executing external utility program from php is not optimal from system point of view (extra process that you block for), its better to just directly use PHP Net/DNS library. This article is good for beginners: http://articles.techrepublic.com.com/5100-22-5234651.html
http://www.cmsws.com/examples/php/domain_verification/example2.php
You end up with hard-coded list where as ICANN may add new TLDs, while it works fine for developer users start doing this and forget about having to update it. I recommend getting IANA list and caching it locally: http://data.iana.org/TLD/tlds-alpha-by-domain.txt
And yours is fatally flawed. Not all ccTLDs are sub-divided.
More specifically some TLDs do delegation from 3rd level domains (.co.uk), some from 2nd level (.com) some are mix of 2 or 3 or more (.kids.us, .us, k12.ca.us). And not only that but some TLDs may even allow direct delivery to TLD - do "dig ws"will not work (such me@tld address is while valid the email would not work because RFC2821 considers it invalid address and because most local mailers would get confused thinking is partial address where it needs to add local domain part). There is really no specific limit min or max for number deligation levels which together forms valid domain. -- William Leibzon Elan Networks william@elan.net

« previous php.general (#260348) next »