added mailer fixes
added testing code