Implement unit tests and document undocumented function arguments.

All functions in the emails.py module now have unit tests that cover parameters
and return types. There were a handful of function parameters missing
documentation, so I added that and removed the 're' import since it isn't
currently being used.