Apache James was born in 2003 as an Apache top level project with the ambition to bring the "mailet" serlvet-for-mail.
20 years later, mailets are still well alive and still proposes a high flexible way to express and overload your email possessing. But Apache James now allows even more extensions: overriding the SMTP stack, listening to mailbox events, adding WebAdmin HTTP endpoints, customizing IMAP commands, and much, much more.
The project also provides a unique toolkit for building your own email server.