Adding logging when emailing