unit-testing

-Unit tests for mail converted over.
-Need to add switch to avoid calling email_to_user when unittest is running.