How can I find the DNS MX record for a given server in Java?

Does anyone know how to get the MX address (e.g. gmail.com) in java using standard libraries? Or do I need to download external?

I use netbeans if this can be useful (if it gives something for this).

+4
source share
1 answer

I also searched for the standard lib for this in java. Unsuccessful.

Then I used dnsjava .

private Record[] lookupMxRecords(final String domainPart) throw TextParseException { final Lookup dnsLookup = new Lookup(domainPart, Type.MX); return dnsLookup.run(); } 
+10
source

All Articles