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


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...
  • Rejected - see
  • Dialup - see
  • Open spam relay - see
Example: <mailet match="" class="ToProcessor"> <processor>spam</processor> </mailet>

Fields Summary
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

            //Try to look it up

            //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;