email logging implementation