Implement unit tests for emails module

Included tests cover parameter checking and return value checking for all
functions included in the emails.py module.