All pastes #486959 Raw Edit

Something

public text v1 · immutable
·published 2007-05-14 05:11 UTC
rendered paste body
<?php

// get posted data into local variables
$EmailFrom = "Site Vistor";
$EmailTo = "joshboese@gmail.com";
$Subject = "Contact Box Message";
$Name = Trim(stripslashes($_GET['Name'])); 
$EmailAddress = Trim(stripslashes($_GET['EmailAddress'])); 
$Message = Trim(stripslashes($_GET['Message'])); 

// validation
$validationOK=true;
if (Trim($Name)=="") $validationOK=false;
if (Trim($EmailAddress)=="") $validationOK=false;
if (Trim($Message)=="") $validationOK=false;
if (!$validationOK) {
  exit;
}

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "\n";
$Body .= "Email address: ";
$Body .= $EmailAddress;
$Body .= "\n";
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";

// send email 
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// echo success or failure
if ($success){
  echo 'Sent successfully.';
}
else{
  echo 'Message send failed. Did you fill out all of the fields?';
}
?>