You must enter your name.'; exit(); } else if(trim($email) == '') { echo '
You must enter email address.
'; exit(); } else if(!isEmail($email)) { echo '
You must enter a valid email address.
'; exit(); } else if(trim($comments) == '') { echo '
You must enter your comments
'; exit(); } // Configuration option. // Enter the email address that you want to emails to be sent to. // Example $address = "joe.doe@yourdomain.com"; $address = $email; // Configuration option. // i.e. The standard subject will appear as, "You've been contacted by John Doe." // Example, $e_subject = '$name . ' has contacted you via Your Website.'; $e_subject = 'Contact Form'; // Configuration option. // You can change this if you feel that you need to. // Developers, you may wish to add more fields to the form, in which case you must be sure to add them here. $e_body = "You have been contacted by $name, their additional message is as follows." . PHP_EOL . PHP_EOL; $e_content = "\"$comments\"" . PHP_EOL . PHP_EOL; $e_reply = "You can contact $name via email, $email"; $msg = wordwrap( $e_body . $e_content . $e_reply, 70 ); $headers = "From: DRAX\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; if(mail($address, $e_subject, $msg, $headers)) { $data['status'] = 200; $data['success'] = true; echo json_encode($data); } else { echo 'ERROR!'; }