It's looked up using the DNS system. Ultimately, that means the DNS server set up to handle the domain in question.
Note that you can't use the DNS system to validate an email address. The best you can do is to verify that the domain used in the email address has a mail server (meaning, an MX record) associated with it.
Ping & DNS - updated with new look and Ping home screen widget
Well, I am testing domain validation on my application. Now I need the boundary conditions:
1. An email address with a registered domain should pass and
2. One with an unregistered domain should fail.
Joined: Mar 22, 2005
So you need to find out if a given domain is registered. The way to do that is not to get a list of all domains, the way to do it is to query the DNS system. The most basic query is for an A record. If that exists, you can proceed further. Namely, there should be an MX record as well, since that's what's used for sending mail.
If what I wrote above doesn't make sense, then you need to read up on the DNS system, and what the various record types mean and how they are used. Otherwise, you'll just be searching in the dark.
Using the above code to validate an email address or the domain rather.
The validation fails on one of the deployments and does not return Lookup.SUCCESSFUL for a valid Domain. The same domain is validated correctly on other deployments. Detailed logs are not available.
Could this issue could have to do with the DNS configuration?
Joined: Mar 22, 2005
Possibly. Or a temporary network issue. Or the environment it's running in. Impossible to say without further information.
Finally some light at the end of the tunnel. I felt I should post this out here lest someone face the same issue.
After having reached out to Brian Wellington (author dnsjava) I understand I can enable dnsjava's debugging by setting dnsjava.options property to "verbose".
After I set the debug level to verbose I was able to see that a java.net.PortUnreachableException is thrown.
In Brian's own words - "The exception is because dnsjava is unable to determine the name server that it should be sending to, and is falling back to the local machine, which is likely not running a name server. Modern versions of dnsjava use the sun.net.dns.ResolverConfiguration class to determine this, which works much better than the prior Windows-specific code, but the version of dnsjava you're using predates that."
I checked using a later version (2.1.3) and all went well.