Fixed the email functionality