最近公司发布了一个JAMES邮件服务器, 第二天早一来, 发现spool里面有几万的垃圾邮件. 在网上仔细查了一下, 一般都是自定义一个matcher和一个mailet, 如:
package com.easynet.mailet;
import java.util.Collection;
import java.util.Iterator;
import java.util.Vector;
import javax.mail.MessagingException;
import org.apache.mailet.GenericMatcher;
import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
public class FilterSenderMatcher extends GenericMatcher {
private static String[] hosts = null;
@Override
public Collection match(Mail mail) throws MessagingException {
//System.out.println("getCondition:" getCondition());
if (hosts == null