Added some logging to sending emails