added email logging