Created
January 21, 2011 00:40
-
-
Save scragz/789030 to your computer and use it in GitHub Desktop.
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 | |
$validation_error = false; | |
if (array_key_exists('submit', $_POST)) { | |
if ( | |
!strlen($_POST['contact_name']) || | |
!strlen($_POST['contact_email']) || | |
!strlen($_POST['contact_message']) | |
) { | |
$validation_error = 'Please complete all required fields.'; | |
} else { | |
$email_body = <<<EOF | |
New contact received from scragz.com. | |
Name: {$_POST['contact_name']} | |
Email: {$_POST['contact_email']} | |
Phone: {$_POST['contact_phone']} | |
Message: | |
{$_POST['contact_message']} | |
EOF; | |
$to = '[email protected]'; | |
$subject = 'New contact received from x.com'; | |
$message = wordwrap($email_body, 70); | |
$headers = "From: [email protected]\r\n" . | |
"Reply-To: {$_POST['contact_email']}\r\n" . | |
"X-Mailer: PHP/" . phpversion(); | |
mail($to, $subject, $message, $headers); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment