Contact Form: Extract processing to functions.

Extract logic from the `process_submission` function to separate functions.