fixed mailer bug but not optimal