Adding an event handler for sending emails.