package org.apache.james.transport.matchers; import java.io.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Collection; import java.util.HashSet; import java.util.Properties;
import javax.mail.*; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import org.apache.mailet.GenericMatcher; import org.apache.mailet.Mail; import org.apache.mailet.MailAddress; import java.lang.Class; public class SenderIsGreyList extends GenericMatcher { private Collection senders; public void init() throws MessagingException { //I want to be able to get the information of the mail here.. how do I do it? I want to know the email sender address, email receiver address and then store it in a collection like senders and match it below. I tried to leave everything here empty and went below and I was able to use mail.getSender() and getReceiver to do the matching. How do I do it here so that it can match properly below? } public Collection match(Mail mail) { if (this.senders.contains(mail.getSender())) { return mail.getRecipients(); } else { return null; } } }