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