Skip to content

Instantly share code, notes, and snippets.

@pilssalgi
Created March 28, 2017 02:38
Show Gist options
  • Save pilssalgi/8d16b499fa6747193078a614d017959f to your computer and use it in GitHub Desktop.
Save pilssalgi/8d16b499fa6747193078a614d017959f to your computer and use it in GitHub Desktop.
mailform php
<?php
$to = 'heowongeun@gmail.com';
$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