-
-
Save gyprosetti/25c2486d67c14eae8169 to your computer and use it in GitHub Desktop.
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(isset($_POST['email'])) { | |
// EDIT THE 2 LINES BELOW AS REQUIRED | |
$email_to = "myemail@gmail.com"; | |
$email_subject = "Enquiry"; | |
$Name = $_POST['Name']; // required | |
$email_from = $_POST['email']; // required | |
$Telephone = $_POST['Telephone']; // not required | |
$Date = $_POST['Date']; // required | |
$Comments = $_POST['Comments']; // required | |
$email_message = "Form details below.\n\n"; | |
function clean_string($string) { | |
$bad = array("content-type","bcc:","to:","cc:","href"); | |
return str_replace($bad,"",$string); | |
} | |
$email_message .= "Name : ".clean_string($Name)."\n"; | |
$email_message .= "email address : ".clean_string($email_from)."\n"; | |
$email_message .= "Telephone : ".clean_string($Telephone)."\n"; | |
$email_message .= "Date : ".clean_string($Date)."\n"; | |
$email_message .= "Comments : \n\n".clean_string($Comments)."\n"; | |
// create email headers | |
$headers = 'From: '.$email_from."\r\n". | |
'Reply-To: '.$email_from."\r\n" . | |
'X-Mailer: PHP/' . phpversion(); | |
if(@mail($email_to, $email_subject, $email_message, $headers)) | |
{ | |
//if email sending is successful | |
//Note the below message variable. It will be echoed at the bottom of the form | |
$complete_message = 'Thank you for your enquiry. We will contact you shortly'; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment