I have been trying to implement server validation to prevent blank emails in my contact us page, but I am not sure on how to do it in PHP, here is my code:
Before your $mail_to..
You can validate the _POST/_GET first on server side.
Alternatively, you can validate first on the client-side. It will save you time and resources.