How can I look up a DNS MX record for a given server in Java?

前端 未结 1 1218
醉梦人生
醉梦人生 2021-01-18 15:50

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

相关标签:
1条回答
  • 2021-01-18 16:09

    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();
    }
    
    0 讨论(0)
提交回复
热议问题