fix sendemail bugs