updated the email functionality