mailer: bug fix and environment