You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Fidel Chavarria <fi...@gmail.com> on 2007/08/23 21:46:38 UTC

Re: mailet to filter words in mail



krishoneil wrote:
> 
> hi.. i'm looking for a mailet that can match word contents, either in
> plain txt or html (not attachment) in emails. 
> 


Hi, you should create your own mailet/matcher for this purpose!

http://james.apache.org/server/2.3.1/index.html
http://www.javaworld.com/javaworld/jw-10-2001/jw-1026-jamesmail.html?page=1

//this matcher allow all recipients
public class MyMatcher extends GenericRecipientMatcher {

	@Override
	public boolean matchRecipient(MailAddress recipient) {
		 return true;
	}

}

//mailet
public class MyMailet extends GenericMailet {

	@Override
	public void service(Mail mail) throws MessagingException {
		for (Object obj : mail.getRecipients()) {
			MailAddress mailAddress = (MailAddress) obj ;			
System.out.println(mail.getMessage().getDescription()) ;
		}
	}

}

-- 
View this message in context: http://www.nabble.com/mailet-to-filter-words-in-mail-tf4139614.html#a12300655
Sent from the James - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org