implemented email functionality