Introduction
SMTP server is currently implemented as only inboud server which accepts e-mail from the internet
and stores them using supplied JavaMail
storage.
Implementation
As already mentioned SMTP server is implemented using
Danube
framework which implements
accepting socket connections
(MultiThreadServerSocketService
)
and passing them to
SMTPConnectionHandler
.
SMTPConnectionHandler
's
resposibility is to wrap
Connection
so it can carry more information that are of internal implementation's concern. Also, it handles
initial greeting and shutting down responses and reseting the "session" data. For all
other processing is forwarded to
SMTPCommandFactory
or extension of it.
There are three implementations of
SMTPCommandFactory
:
- SMTPCommandFactory
itself
-
This factory implements SMTP server commands directly without involving any
extra code to direct should e-mail be accepted or not. Only check is done to determine if
destination domain and mailbox are available or not.
- SMTPFilterCommandFactory
-
This implementation allows extra set of
Filter
s to be implemented
which are then registered with the factory. Factory is then calling appropriate
Filter
's methods
in various stages of processing client's request and receiving an e-mail message.
At each of these steps
Filter
implementation
can terminate the process with appropriate error that is passed back to the client.
- SMTPQuietFilterCommandFactory
-
implementation of it is very similar to
SMTPFilterCommandFactory
but this implementation do not return error back to the user and rather quietly drops the
incoming e-mail message.