Created
March 28, 2017 02:38
-
-
Save pilssalgi/8d16b499fa6747193078a614d017959f to your computer and use it in GitHub Desktop.
mailform php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$to = '[email protected]'; | |
$name = $_POST['name']; | |
$company = $_POST['company']; | |
$email = $_POST['email']; | |
// Email Submit | |
// Note: filter_var() requires PHP >= 5.2.0 | |
if ( isset($email) && isset($name) && isset($company) && filter_var($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; | |
} | |
} | |
$body = <<<EMAIL | |
$title | |
Name : $name | |
Company : $company | |
Email : $email | |
EMAIL; | |
$header = 'From: ' . $_POST["name"] . '<' . $_POST["email"] . '>' . "\r\n" . | |
'Reply-To: ' . $_POST["email"] . "\r\n" . | |
'X-Mailer: PHP/' . phpversion(); | |
// | |
//mail( $to , $_POST['subject'], $_POST['message'], $header ); | |
mail($to, 'interzum applycation', $body, $header); | |
// ^ | |
// Replace with your email | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment