added function to store email in database