= 5.2.0 if ( isset($_POST['email']) && isset($_POST['name']) && isset($_POST['subject']) && isset($_POST['message']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ) { // detect & prevent header injections $test = "/(content-type|bcc:|cc:|to:)/i"; foreach ( $_POST as $key => $val ) { if ( preg_match( $test, $val ) ) { exit; } } $headers = 'From: ' . $_POST["name"] . '<' . $_POST["email"] . '>' . "\r\n" . 'Reply-To: ' . $_POST["email"] . "\r\n" . 'X-Mailer: PHP/' . phpversion(); // mail( "khaitawng2014@gmail.com", $_POST['subject'], $_POST['message'], $headers ); // ^ // Replace with your email } ?>