Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How reliable is checkdnsrr (for email domain validation)?

Tags:

php

dns

I am wondering whether there is a realistic chance of a false negative when utilising checkdnsrr to check the domain part of a provided email address? I want to check this coming from a registration form to reduce the amount of mistypes on the client side.

$hostCheck = checkdnsrr("test.org", "MX");

Is checkdnsrr just "pretty reliable" or is there no practical chance of missing an actually existing domain? Because then I would omit such a check. I would appreciate an explanation on the WHYs of the reliability of the whole process. I have researched DNS (some), but I am not certain whether things like servers being temporarily offline or something else might have a measurable impact here.

like image 765
Hendrik Avatar asked Dec 06 '12 19:12

Hendrik


1 Answers

No, this isn't reliable. dns isn't reliable in general. It's best-effort. It can also take a long time when an invalid domain is provided, so you need to consider a potential DOS of your system if someone hammers your script with a lot of invalid/offline domains.

In (little known) fact, domains don't even need to have an MX record for mail to be delivered. Mail delivery is supposed to fall back to using the A record for the host specified. That may not really happen much these days, but in theory..

like image 180
Julian Avatar answered Oct 20 '22 06:10

Julian