Skip to content

Instantly share code, notes, and snippets.

@leopic
Created December 25, 2012 21:04
Show Gist options
  • Save leopic/4375458 to your computer and use it in GitHub Desktop.
Save leopic/4375458 to your computer and use it in GitHub Desktop.
<?php
$name = $_POST['contact-name'];
$email = $_POST['contact-email'];
$comments = $_POST['contact-comment'];
$sender = $_POST['contact-sender'];
$receiver = $_POST['contact-receiver'];
if (!is_null($name) && !is_null($email) && !is_null($comments)) {
$subject = "[Strongbowcider.us] " . substr($comments, 0, 20) . "...";
$body = "Name: $name <$email> \n\nComments: $comments";
$headers = 'From:' . $sender . "\r\n" .
'Subject:' . $subject . "\r\n"; .
'Reply-To:' . $email . "\r\n";
if(mail($receiver, $subject, $body, $headers)) {
echo "1";
} else {
echo "2";
}
} else{
echo "2";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment