Updated email functionality