worked on sendmail function