Rework of the email function

Overhaul