working out the email handling