Added email sending code