added mailer functionality wherever necessary