fix bugs of controllers/mailer.js and add mocha tests