The Apache James is a pure Java SMTP, POP3 Mail server, IMAP and NNTP News server designed to be a complete and portable mail/messaging engine solution based on open messaging protocols.
The Apache James Project delivers a rich set of open source modules and libraries, written in Java, related to Internet mail communication which build into an advanced enterprise mail server. Thanks to extensible design James may serve as embedded mail server or as a base for custom mail processing software.
Some of James's modules are exposed as a separate artifacts, like SPF implementation, Sieve language implemntation or DKIM implementation.
Useful links:
James mailet API, robust Java API for custom mail processing rules