mailer script from chapter 4