I'd imagine you should be able to do all that with hmail as the mail server.. hmail has COM support (to do MANY things from vbscript/php/etc from command line if needed) plus if you are careful you can modify the SQL database directly if needed.
Here is some info:http://www.hmailserver.com/documentatio ... om_objectshttp://www.hmailserver.com/documentatio ... unt_createhttp://www.hmailserver.com/documentatio ... ce_scripts
As far as "Throwing it all away" would deleting the Data folder (all emails are stored there) and creating a new hmail database suffice? Could always uninstall hmail & reinstall it if needed but not sure of your exact requirements. I actually have virtual machines setup with everything fresh & have undo enabled so I can easily close it & clear undo to start back at square one easily (for testing) without need to install everything again so not sure if that'd be useful to you.
As far as licensing, hmail4 was open source under GPL but hmail5 is closed source & still free. martin (the author) has announced hmail5.4 will be open again but not announced exact licensing. I was trying to find the license on this site but have been unable to but you can download the latest version & open License.rtf that is included with it if you want to read the entire text. I'd paste here but it is VERY long.http://www.hmailserver.com/?page=download
Hope that helps.