trapmail is a sendmail replacement for unit- and integration-testing that captures incoming mail and stores it on the filesystem. See the documentation for details.
trapmail
sendmail