Try GreenMail. It's geared towards JUnit usage, but it should do what you need. You can run it in a JBoss instance or have your JUnit tests send mail to themselves, depending on your specific needs.
There are a few other similar bits of software out there, but that's the one I've used and was reasonably happy with it.