fix sendemail funciton