update sendmail function