Extracted the mail sending logic to a form handler