add test coverage for the action mailer

additionally update code according to a style guide