Added email notification logic