Error
Something has gone wrong ... most likely you accessed this page directly."; include("bottom.php"); return; };
// Website Contact Form Generator
// http://www.tele-pro.co.uk/scripts/contact_form/
// This script is free to use as long as you
// retain the credit link
// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
$EmailTo = Trim(stripslashes($_POST['EmailTo']));
$Subject = Trim(stripslashes($_POST['Subject']));
$Name = Trim(stripslashes($_POST['Name']));
$Address = Trim(stripslashes($_POST['Address']));
$Message = Trim(stripslashes($_POST['Message']));
$Province = Trim(stripslashes($_POST['Province']));
$PostalCode = Trim(stripslashes($_POST['PostalCode']));
$City = Trim(stripslashes($_POST['City']));
//pb's moderately pathetic attempt at validation
if (empty($EmailFrom) || empty($Name) || empty($Address) || empty($Message) || empty($PostalCode) || empty($City))
{ echo "Error
All fields in the form are required, please click 'back' in your browser and ensure all the fields are complete."; include("bottom.php"); return; };
// prepare email body text
$Body = "";
$Body .= "An email to ";
$Body .= $EmailTo;
$Body .= "\n";
$Body .= "\n";
$Body .= $Message;
$Body .= "\n";
$Body .= "\n";
$Body .= "\n";
$Body .= "I look forward to your response,";
$Body .= "\n";
$Body .= "\n";
$Body .= $Name;
$Body .= "\n";
$Body .= $Address;
$Body .= ", ";
$Body .= $City;
$Body .= ", ";
$Body .= $Province;
$Body .= " ";
$Body .= $PostalCode;
$Body .= "\n";
$Body .= $EmailFrom;
// send email
require_once('Mail.php');
$headers = array();
if ($EmailTo == 'Patrick Bragg') { $headers['To'] = 'braggp@psac.com, braggp@psac.com'; };
if ($EmailTo == 'Team Sandwich') { $headers['To'] = 'teamsandwich@gmail.com, braggp@psac.com'; };
// $headers['Cc'] = 'teamsandwich@gmail.com';
$headers['From'] = $EmailFrom;
$headers['Subject'] = $Subject;
$recipients = array();
$recipients[] = $headers['To'];
$mail = &Mail::factory('smtp', array('host' => 'localhost'));
$success = !PEAR::isError($mail->send($recipients, $headers, $Body));
// redirect to success page
if ($success){
print "Success!
Your email has been sent to ";echo($EmailTo);print".
";
include("bottom.php"); return;
}
else{
{ echo "Error
There was a problem with the mail script: please click 'back' in your browser and submit the form again."; include("bottom.php"); return; };
}
include("bottom.php");