public class DnsResolver extends Object
| Modifier and Type | Field and Description |
|---|---|
private static org.slf4j.Logger |
log |
static String |
SMTP_PROTOCOL_PREFIX |
| Constructor and Description |
|---|
DnsResolver() |
| Modifier and Type | Method and Description |
|---|---|
static Collection<javax.mail.URLName> |
getMXRecordsForHost(String hostName)
This method gives back the host name(s) where we can send the email.
|
private static final org.slf4j.Logger log
public static final String SMTP_PROTOCOL_PREFIX
public static Collection<javax.mail.URLName> getMXRecordsForHost(String hostName)
This method gives back the host name(s) where we can send the email. It is copied from it's original place in RemoteDelivery object.
First time we ask DNS to find MX record(s) of a domain name. If no MX records are found, we check the upper level domains (if exists). At last we try to get the domain A record, because the MX server could be same as the normal domain handler server. If only upper level domain has MX record then we append the A record of original hostname (if exists) as first element of record collection. If none of these tries are successful, we give back an empty collection.
Special Thanks to Tim Motika (tmotika at ionami dot com) for his reworking of this method.hostName - We search the associated MX server of this hostname.Copyright © 2013. All Rights Reserved.