add logging when sending emails