Email service refactoring. Adding first test.