Updating email sending code