/** * @see org.apache.mailet.MailetContext#getMailServers(String) */ public Collection<String> getMailServers(String host) { try { return dns.findMXRecords(host); } catch (TemporaryResolutionException e) { // TODO: We only do this to not break backward compatiblity. Should // fixed later return Collections.unmodifiableCollection(new ArrayList<String>(0)); } }
@Override protected boolean hasMXRecord(SMTPSession session, String domain) { // null sender so return if (domain == null) { return false; } Collection<String> records = null; // try to resolv the provided domain in the senderaddress. If it can not resolved do not accept it. try { records = dnsService.findMXRecords(domain); } catch (org.apache.james.dnsservice.api.TemporaryResolutionException e) { // TODO: Should we reject temporary ? } return !(records == null || records.size() == 0); }
@Override public Collection<String> getMailServers(Domain host) { try { return dns.findMXRecords(host.asString()); } catch (TemporaryResolutionException e) { // TODO: We only do this to not break backward compatiblity. Should // fixed later return ImmutableSet.of(); } }
/** * @see org.apache.james.protocols.smtp.DNSService#findMXRecords(java.lang.String) */ public Collection<String> findMXRecords(String hostname) throws TemporaryResolutionException { try { return dns.findMXRecords(hostname); } catch (org.apache.james.dnsservice.api.TemporaryResolutionException e) { throw new TemporaryResolutionException(e.getMessage()); } }
public Iterator<HostAddress> retrieveHostAddressIterator(String host) throws TemporaryResolutionException { if (configuration.getGatewayServer().isEmpty()) { return new MXHostAddressIterator(dnsServer.findMXRecords(host).iterator(), dnsServer, USE_SEVERAL_IP); } else { return new MXHostAddressIterator(configuration.getGatewayServer().iterator(), dnsServer, USE_SEVERAL_IP); } }
/** * 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. * * @param domainName - the domain for which to find mail servers * @return an Iterator over HostAddress instances, sorted by priority * @see org.apache.james.dnsservice.api.DNSService#getHostName(java.net.InetAddress) * @since Mailet API v2.2.0a16-unstable */ @Override @Deprecated public Iterator<org.apache.mailet.HostAddress> getSMTPHostAddresses(Domain domainName) { try { return new MXHostAddressIterator(dns.findMXRecords(domainName.asString()).iterator(), dns, false); } catch (TemporaryResolutionException e) { // TODO: We only do this to not break backward compatiblity. Should // fixed later return ImmutableSet.<org.apache.mailet.HostAddress>of().iterator(); } }
mx = dnsService.findMXRecords(domain).iterator(); } catch (TemporaryResolutionException e1) { return new HookResult(HookReturnCode.DENYSOFT);
mx = dnsService.findMXRecords(domain.name()).iterator(); } catch (TemporaryResolutionException e1) { return HookResult.DENYSOFT;