What is the Apache Mailet API?

The Apache Mailet API is a Java API which allows the rapid development and flexible deployment of email processing functionality.

The Mailet API is a subproject of Apache James. All who are interested in developing the Mailet API and James will be warmly welcomed on the mailing lists.

Quick Start

What Is A Mailet?

A mailet is a mail processing component. Though there are some differences, a servlet as a HTTP processing component is a useful analogy.

Mailets implement Mailet. Mailets execute within a mailet container. James server is a well known mailet container. Assembly and configuration of mailets and mail processors is the responsibility of the particular container.

Mailet Basic Lifecycle

Mailets have a simple lifecycle managed by the mailet container:

  1. init( MailetConfig config) passes environmental information. Any setup necessary should be performed now.
  2. During processing, service( Mail mail) is called repeatedly. Note that this method may be called concurrently.
  3. destroy() is called when the mailet is taken out of service.


MailetConfig gives access to simple parametrization. getInitParameter allows configuration parameters to be passed from the mailet container. How these parameters are set by the user of the mailet is the responsibility of the container. More sophisticated configuration and assembly (for example, allowing access to services) is also the responsibility of the container.

Communication With The Container

MailetConfig allows communication with the container by calling getMailetContext(). See MailetContext for more details.

Basic Toolkit

The Basic Mailet Toolkit collects lightweight frameworks and utilities likely to be useful for general mailet developers.


See Standard mailets.

Building the Mailet API

The build uses Ant. ant -projecthelp describes appropriate targets. ant runs the default target.

Comments, Questions and Issues

Please direct your feedback to the mailet-api mailing list.