Skip to content

Instantly share code, notes, and snippets.

@kixxauth kixxauth/contact.php
Last active Dec 16, 2015

Embed
What would you like to do?
Contact form email sending in PHP
<?php
// If there were *no* submission errors:
if ($err === 0) {
if (function_exists('htmlspecialchars_decode')) {
$subject = htmlspecialchars_decode($subject);
$message = htmlspecialchars_decode($message);
}
$message .= "\r\nPhoneNumber: " . $phone;
$headers = "Content-type: text/plain; charset=UTF-8\r\n";
$headers .= "From: " . $name . "<" . $email . ">\r\n";
$headers .= "Reply-To: $email" . "\r\n";
mail(MAILTO, SUBJECT_PREFIX . " - " . $subject, $message, $headers);
// Return the 'noscript' response.
if (empty($_POST['js'])) {
readfile(CONFIRM_PAGE);
}
// Return the Ajax response.
else {
echo 'OK:' . CONFIRM_PAGE;
}
}
// There was a submission error:
else {
// Return the 'noscript' response.
if (empty($_POST['js'])) {
echo $html_error_page_header . $err . $html_error_page_footer;
}
// Return the Ajax response.
else {
echo $err;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.