fixed code to send via email