add error handling to mailer