Add testcase for when smtplib.sendmail fails.
Move CLI parser creation into its own function.
Add project test cases and fixes.
Add tests for main function.