Added email sending code.