5
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by almostbob
0

if you are using this for a contact form you should use smtp to send rather than sendmail.
however here is some simple code that works for me regardless.
This assumes you have a contact form with name email and comments fields
You may want to use php injection prevention to stop people sending emails how they shouldn't be sent

form.php
<?php
if (isset($_POST['email'])){
/* Email Variables */

$emailSubject = 'onlinecustomer!';
$webMaster = 'your email';


/* Data Variables */

$email = $_POST['email'];
$name = $_POST['name'];
$comments = $_POST['comments'];



$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>

Comments: $comments <br>
<font size="6">BIG FONT</font>
html formatting will work fine in most cases
EOD;


$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body,
$headers);
}
?>

hope this helps :)

personnally i feel it helps for people to post code rather than a link :P

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.