fix email function and format