At some point, such as when the mailet container is shut down,
the mailet is taken out of service and then destroyed by invoking
the destroy() method once.

In addition to the life-cycle methods, this interface provides the
getMailetConfig() method, which provides the Mailet with
its initialization parameters and a MailetContext through which
it can interact with the mailet container, and the getMailetInfo()
method, which provides basic information about the Mailet.

Mailets are grouped by the mailet container's configuration into processors.
Each processor is comprised of an ordered sequence of Mailets, each with a
corresponding Matcher. A Mail message is processed by each
Matcher-Mailet pair in order: If the mail is matched by the Matcher, it is
passed to the Mailet's service method for processing, and if it is
not matched, the Mailet is skipped and the mail moves on to the next
Matcher-Mailet pair.

The service method performs all needed processing on the Mail,
and may modify the message content, recipients, attributes, state, etc.
When the method returns, the mail is passed on to the next Matcher-Mailer
pair in the processor. If there are no subsequent mailets in the processor,
it is moved to the error processor.
Setting the Mail state to Mail.GHOST, or clearing its
recipient list, both mean that no further processing is needed, which will
cause the Mail to be dropped without ever reaching subsequent Mailets.

Instead of creating new messages, the mailet can put a message with new recipients
at the top of the mail queue, or insert them immediately after it's execution
through the API are provided by the MailetContext interface.

service

Mailets typically run inside multithreaded mailet containers that can handle
multiple requests concurrently. Developers must be aware to synchronize access
to any shared resources such as files and network connections, as well as the
mailet's fields. More information on multithreaded programming in Java is
available at the
Java tutorial on multi-threaded programming.

Parameters:

mail - the Mail to process

Throws:

javax.mail.MessagingException - if any error occurs which prevents the Mail
processing from completing successfully

destroy

void destroy()

Destroys this Mailet.

This method is called only once, after all service(org.apache.mailet.Mail) invocations
have completed (or a timeout period has elapsed). After this method
returns, this Mailet will no longer be used.

Implementations should use this method to release any resources that
are being held (such as memory, file handles or threads) and make sure
that any persistent information is properly stored.