Fixed code for sending email