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

InSpammerBlacklist

public class InSpammerBlacklist extends org.apache.mailet.GenericMatcher
Checks the network IP address of the sending server against a blacklist of spammers. There are 3 lists that support this...
  • blackholes.mail-abuse.org: Rejected - see http://www.mail-abuse.org/rbl/
  • dialups.mail-abuse.org: Dialup - see http://www.mail-abuse.org/dul/
  • relays.mail-abuse.org: Open spam relay - see http://www.mail-abuse.org/rss/
Example: <mailet match="InSpammerBlacklist=blackholes.mail-abuse.org" class="ToProcessor"> <processor>spam</processor> </mailet>

Fields Summary
String
network
Constructors Summary
Methods Summary
public voidinit()


         
        network = getCondition();
    
public java.util.Collectionmatch(org.apache.mailet.Mail mail)

        String host = mail.getRemoteAddr();
        try {
            //Have to reverse the octets first
            StringBuffer sb = new StringBuffer();
            StringTokenizer st = new StringTokenizer(host, " .", false);

            while (st.hasMoreTokens()) {
                sb.insert(0, st.nextToken() + ".");
            }

            //Add the network prefix for this blacklist
            sb.append(network);

            //Try to look it up
            org.apache.james.dnsserver.DNSServer.getByName(sb.toString());

            //If we got here, that's bad... it means the host
            //  was found in the blacklist
            return mail.getRecipients();
        } catch (UnknownHostException uhe) {
            //This is good... it's not on the list
            return null;
        }