updated logic on mailer