added some logging to email