Mail refactored a bit and got unit test