There are numerous ways to check for required fields. Your also not limited to PHP, JavaScript can perform these checks before the form is submitted. However, here is one way you could do it:
The changes I've made are pretty straight forward. At the first if statement I've added on a check to see whether the fields are empty or not. If they are, the entire send mail block is skipped. I then perform a similar check in the later part of the code, which outputs an error if any of these fields are empty.
Hope that helps
