Antispam, antivirus, authenticating SMTP daemon. Integrates with qmail, sendmail, stunnel, etc. It's simple Perl, so you can hack it to suit your needs. Supports RBLs, mx on from, bounce evil phrases, virus scanning.
http://www.ziddu.com/download/7053122/Perl-esmtpd-0.9.zip.html