1 package org.apache.james.samples.mailets; 2 3 16 17 import javax.mail.MessagingException ; 18 19 import org.apache.mailet.Mail; 20 import org.apache.mailet.Mailet; 21 import org.apache.mailet.MailetConfig; 22 import org.apache.mailet.MailetContext; 23 24 27 public class HelloWorldMailet implements Mailet { 28 29 private MailetConfig config; 30 31 public void destroy() { 32 33 } 34 35 public String getMailetInfo() { 36 return "Example mailet"; 37 } 38 39 public MailetConfig getMailetConfig() { 40 return config; 41 } 42 43 public void init(MailetConfig config) throws MessagingException { 44 this.config = config; 45 } 46 47 public void service(Mail mail) throws MessagingException { 48 MailetContext context = config.getMailetContext(); 49 context.log("Hello, World!"); 50 context.log("You have mail from " + mail.getSender().getUser()); 51 } 52 } 53 | Popular Tags |