Refactor mailer, update README and add test