class EmailMessage is more robust, add unit test to test some parts of it