modify sendMail function