SubEthaSMTP is an easy to understand Java library that provides a receptive SMTP server component. By plugging this component into your Java application, you can easily receive SMTP mail using a simple abstract Java interface. Also included is a small sub-project called Wiser, an easy to use incoming mail testing framework.
GreenMail is a suite of email servers for testing purposes and sandbox development. It supports SMTP, POP3, and IMAP (including SSL) and can be embedded into any Java application or unit test. The GreenMail Service (SAR) extension runs as a JBoss embedded developer mail server sandbox, manageable via JMX.