|
 Sam S - 2009-06-29 02:09:05
Roberto,
I thank you for contributing this class, but I immediately wandered, "What if the host does not have a webserver responding on port 80?". Might I suggest you try checking for a valid DNS entry instead, as in the following example:
list($user, $domain) = explode("@", $email);
$id = checkdnsrr($domain.'.', 'MX') || checkdnsrr($domain.'.', 'A') || checkdnsrr($domain.'.', 'CNAME');
It will only work on a Windows box if you use a hack for the checkdnsrr function though. <http://us2.php.net/manual/en/function.checkdnsrr.php>
You could also try opening a socket to the domain on port 25:
$id = ($f = fsockopen($domain, 25)) && fclose($f);
 Roberto Aleman - 2009-06-29 14:19:56 - In reply to message 1 from Sam S
hello, thanks for your comment, I decided make this class since does
not find a simple that validated of different manners an email correctly,
well, the idea of a valid email is that exists this email, your comment
is correct, although, as truthes, the class validates in different levels...
1.- check length of email address max is 320 characters where:
64 characters max for the user of email address
1 character max for the @
255 characters max for the host name
2.- apply regular expressions to valid email addres string
3.- check if exist host to send messages to email address
the next level, it is the one which you speak, that is verified by means of the port 25...
if pass to him all of these verifications, the following level in order
that all is perfect, is to send a test email from an existent account
and capture the answer, if the email exist returns error, of this way
it believes that the validity is total.
although despues of all, believe that if an address of email, not has
not HTTP answer is because not this is used, to remain on the side
of who want to use the class opine about the matter
|