add mailer, refactor router to allow custom routes