Feature email API junits

This is a pull request for the email API's junit tests. Please review it.