Total amateur hour right here. Needing help with a email confirmation script.

So. I am trying to build a script that would allow for a user to send a simple html confirmation email to a selected indivdual. I got this to work as a simple text email, but I would like to modify this code to send a html email with the variables included.

[php]

<?php $EmailFrom = "[email protected]"; $Subject = "Test Script"; $Name = Trim(stripslashes($_POST['Name'])); $LastName = Trim(stripslashes($_POST['LastName'])); $Local = Trim(stripslashes($_POST['Local'])); $Email = Trim(stripslashes($_POST['Email'])); $EmailTo = $Email; // validation $validationOK=true; if (!$validationOK) { print ""; exit; } // prepare email body text $Body .= "Dear "; $Body .= $Name; $Body .= " "; $Body .= $LastName; $Body .= "\n"; $Body .= " Your email is: "; $Body .= $Email; $Body .= "\n"; $Body .= " The location you have choosen is "; $Body .= $Local; $Body .= "."; $Body .= "\n"; $Body .= "Thank you Sincerly,"; $Body .= "\n"; $Body .= "Hershal Bladderfish"; // send email $success = mail($EmailTo, $Subject, $Body, $headers, "From: <$EmailFrom>"); // redirect to success page if ($success){ print ""; } else{ print ""; } ?>

[/php]

i believe all you need is the right headers. i rewrote your script to include them.

[php]
$Name = $_REQUEST[‘Name’];
$LastName = $_REQUEST[‘LastName’];
$Local = $_REQUEST[‘Local’];
$Emailto = $_REQUEST[‘Email’];
$EmailFrom = "[email protected]";
$Subject = “Test Script”;
$headers = “From: $EmailFrom \r\n”;

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// prepare email body text
$Body = "Dear ".$Name." ".$LastName."<br />";
$Body .= "Your email is: ".$Emailto."<br />";
$Body .= "<a href='http://www.drewdio.com/'>drewdio.com/</A><br />";
$Body .= "Thank you Sincerly,<br />";
$Body .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hershal Bladderfish";
// send email

$success = mail($Emailto, $Subject, $Body, $headers);
if ($success){
print “<meta http-equiv=“refresh” content=“1;URL=http://www.drewdio.com/contactthanks.html”>”;
}
else{
print “<meta http-equiv=“refresh” content=“0;URL=error.html”>”;
}

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service