Writing emails to the email table