Mailets and Matchers
Although James is a mail server, it is also a mailet container. Similar to the way J2EE containers power Enterprise Java Beans, James powers mailets. (Mailets are used to process mail, and matchers are used to match mail messages against certain conditions.) James ships with a number of predefined matchers and mailets.
The concepts might best be displayed by example. Let's say that you want to add the following message footer to each email received by James:
------------------------------------------------ Brought to you courtesy of Apache James
You can use the AddFooter mailet and the "All" matcher to add the footer. Add the following to your config.xml file:
<mailet match="All" class="AddFooter"> <text> ------------------------------------------------ Brought to you courtesy of Apache James </text> </mailet>
After a restart of James, all mail sent to any email address that James is hosting will have the footer added to the end of the e-mail, as shown in Figure 3.
Figure 3 The footer is dynamically attached to the e-mail.