问题
Anybody knows how to get MX address (from for example gmail.com) in java using standard libraries? Or do I need to download external one?
I'm using netbeans if it can be helpful (if it provides something for this).
回答1:
I was also searching for standart lib for this in java. Unsuccessful.
Then I have used dnsjava.
private Record[] lookupMxRecords(final String domainPart) throw TextParseException
{
final Lookup dnsLookup = new Lookup(domainPart, Type.MX);
return dnsLookup.run();
}
来源:https://stackoverflow.com/questions/14042742/how-can-i-look-up-a-dns-mx-record-for-a-given-server-in-java