wrote function to send mail