Created
November 10, 2016 16:03
-
-
Save knorthfield/db45c9bc81a79d822483edfed9a1780c to your computer and use it in GitHub Desktop.
PHP basic mailer
This file contains 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 | |
if( $_SERVER['REQUEST_METHOD'] == 'POST' ){ | |
$message = implode("\n", array_map(function ($v, $k) { return $k . ': ' . $v; }, $_POST, array_keys($_POST))); | |
$headers = 'From: contact_form@example.com'; | |
mail('info@example.com', 'Website Contact Form', $message, $headers); | |
header("Location: http://www.example.com/thankyou"); | |
die(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment