Update complete sendmail function