email functionality bug fix