<?php
// You must have a field in your form with name="Email" -- or have $from set below
//$to is the reciepiant of the email eg. info@domain.com
$to = "thirdcatgy@aol.com";
//$subject is the subject of the email
$subject = "Contact Results from Domain.com";
//The thank you page they will see after the email has been sent, include the full path to the file
$thank_you = "http://www.domain.com/thank_you.html";
//Optional: The email address you want the email to come from.
$from = "";
//You don't need to change anything below this.
$allEmpty = true;
foreach( $_REQUEST as $e=>$v ) {
if( trim($v) != "" ) {
$allEmpty = false;
$data[$e] = trim($v);
}
}
foreach( $data as $e=>$v ) {
if( is_array($v) ) {
$message .= "\n".$e.":\n";
foreach( $v as $v2 ) {
$message .= $v2."\n";
}
} else {
$message .= $e.": ".$v."\n";
}
}
if( isset($from) && $from != "" ) {
$send_From = $from;
} else {
$send_From = $_REQUEST['Email'];
}
$headers = 'From: ' .$send_From. "\r\n" .
'Reply-To: ' .$send_From. "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
header("Location: ".$thank_you);
?>