FileDocCategorySizeDatePackage
SenderInFakeDomain.javaAPI DocApache James 2.3.13358Fri Jan 12 12:56:32 GMT 2007org.apache.james.transport.matchers

SenderInFakeDomain

public class SenderInFakeDomain extends AbstractNetworkMatcher
Does a DNS lookup (MX and A/CNAME records) on the sender's domain. If there are no entries, the domain is considered fake and the match is successful.

Fields Summary
Constructors Summary
Methods Summary
public java.util.Collectionmatch(org.apache.mailet.Mail mail)

        if (mail.getSender() == null) {
            return null;
        }
        String domain = mail.getSender().getHost();
        //DNS Lookup for this domain
        Collection servers = getMailetContext().getMailServers(domain);
        if (servers.size() == 0) {
            //No records...could not deliver to this domain, so matches criteria.
            log("No MX, A, or CNAME record found for domain: " + domain);
            return mail.getRecipients();
        } else if (matchNetwork(servers.iterator().next().toString())){
            /*
             * It could be a wildcard address like these:
             *
             * 64.55.105.9/32          # Allegiance Telecom Companies Worldwide (.nu)
             * 64.94.110.11/32         # VeriSign (.com .net)
             * 194.205.62.122/32       # Network Information Center - Ascension Island (.ac)
             * 194.205.62.62/32        # Internet Computer Bureau (.sh)
             * 195.7.77.20/32          # Fredrik Reutersward Data (.museum)
             * 206.253.214.102/32      # Internap Network Services (.cc)
             * 212.181.91.6/32         # .NU Domain Ltd. (.nu)
             * 219.88.106.80/32        # Telecom Online Solutions (.cx)
             * 194.205.62.42/32        # Internet Computer Bureau (.tm)
             * 216.35.187.246/32       # Cable & Wireless (.ws)
             * 203.119.4.6/32          # .PH TLD (.ph)
             *
             */
            log("Banned IP found for domain: " + domain);
            log(" --> :" + servers.iterator().next().toString());
            return mail.getRecipients();
        } else {
            // Some servers were found... the domain is not fake.

            return null;
        }