improved code Mail
added test for mail