before you even call mail() you have to check that the necessary fields are filled in.
isset($POST['fieldname']) will check to see if the user entered information in a field. BUT, because the user could have just hit the space bar in a text box, you could check it using this:
if($strlen(trim($_POST['fieldname'])) < 1){
//...error handling in here
}
What I usually do is create a variable called $mailmsg and initialize it to nothing. Then when I check for fields, I append the field to the var, thus creating the message body string.
$mailmsg = "";
if($strlen(trim($_POST['fieldname'])) > 0){
$mailmsg .= $_POST['fieldname']);
}
then when you call mail, pass $mailmsg as the body of the email.
mail($toemail,$fromemail,$mailmsg);