update sendemail function from