/** * Performs DNS lookups as needed to find servers which should or might * support SMTP. Returns an Iterator over HostAddress, a specialized * subclass of javax.mail.URLName, which provides location information for * servers that are specified as mail handlers for the given hostname. This * is done using MX records, and the HostAddress instances are returned * sorted by MX priority. If no host is found for domainName, the Iterator * returned will be empty and the first call to hasNext() will return false. * * @see org.apache.james.dnsservice.api.DNSService#getSMTPHostAddresses(String) * @since Mailet API v2.2.0a16-unstable * @param domainName * - the domain for which to find mail servers * @return an Iterator over HostAddress instances, sorted by priority */ public Iterator<HostAddress> getSMTPHostAddresses(String domainName) { try { return dns.getSMTPHostAddresses(domainName); } catch (TemporaryResolutionException e) { // TODO: We only do this to not break backward compatiblity. Should // fixed later return Collections.unmodifiableCollection(new ArrayList<HostAddress>(0)).iterator(); } }
/** * @see org.apache.james.protocols.smtp.DNSService#getSMTPHostAddresses(java.lang.String) */ public Iterator<HostAddress> getSMTPHostAddresses(String domainName) throws TemporaryResolutionException { try { return dns.getSMTPHostAddresses(domainName); } catch (org.apache.james.dnsservice.api.TemporaryResolutionException e) { throw new TemporaryResolutionException(e.getMessage()); } }