Page 1 of 1

checkdnsrr()

Posted: Tue May 31, 2005 9:00 pm
by hawleyjr
I found the following code using the php function checkdnsrr()

http://us2.php.net/manual/en/function.checkdnsrr.php

I did a search on this site and only found a dozen or so questions about it which leads me to think not very many people use this function for such things as email validation.

Just out of curiosity, does anyone rely on this function or a similar function for email verification?

http://www.sitepoint.com/article/users- ... ddress-php

Code: Select all

// take a given email address and split it into the  
username and domain.
list($userName, $mailDomain) = split("@", $email);
if (checkdnsrr($mailDomain, "MX")) {
 // this is a valid email domain!
}
else {
 // this email domain doesn't exist! bad dog! no biscuit!
}

Posted: Wed Jun 01, 2005 8:08 am
by Spaceboy
I have never used it, but it looks pretty useful, so I'm going to start.

Posted: Wed Jun 01, 2005 8:30 am
by timvw
you might want to search at zend.com for a larger article ;)

and at phpclasses you can find a validator, which allows you to specify the specified level... (regular rexpression, mx record, ...)

Posted: Mon Jul 11, 2005 12:36 pm
by Chris Corbyn
Hmmm... something like this_isnt_a_real_email_address@hotmail.com would still be valid but it beats standard regex checking methods!

/me pops into snippets folder ;)

Posted: Mon Jul 11, 2005 12:59 pm
by Roja
d11wtq wrote:Hmmm... something like this_isnt_a_real_email_address@hotmail.com would still be valid but it beats standard regex checking methods!

/me pops into snippets folder ;)
Gimme a week or two, and I'll have a link to the subversion repository entry for the regex we use for validating email addresses in the game project I'm working on.

Its opensource, and its RFC-compliant. I just haven't had time to commit the code yet. :)

And yes, that is a valid email address - so it does make it through regex. :)

The regex detects if it is *valid*, not if it is *active*. Active email addresses can only reliably be detected by sending an email and getting a response. All other tests (check user exists, knock, user info, etc) all have been used by spammers and are disabled by default in a non-trivial number of mail servers. (and thus, unreliable).

Of course, checking the domain name has a mx record is yet another issue..

Posted: Tue Jul 12, 2005 10:39 pm
by Roja
Roja wrote: Gimme a week or two, and I'll have a link to the subversion repository entry for the regex we use for validating email addresses in the game project I'm working on.
Sorry for the delay. Its up!

http://svn.gna.org/viewcvs/blacknova/tr ... iew=markup

Very simple. Pass it an RFC compliant email, and it returns true. Pass it bogus info, and it returns false.

Patches, comments, and rude limericks all welcome.