Rewriting mailer code
Added requirements
Made the code better