Email - Headers << Email - Making Forms >> Email - HTML Emails
Using the previous examples would automatically send an email out when you view the webpage. This is generally not the effect most people are going for. Using a FORM to gather information from the visitor and have it sent to an email is probably the most popular use.

<title> My Test Form </title>
Send us an comment about our site!<br />
<form action="process.php" method="post">
Subject for email : <input type="text" name="subject"><br />
Visitor email : <input type="text" name="from"><br />
Message : <textarea name="message" rows="3" cols="40"></textarea><br />
<input type="submit" value="Send the info">
<input type="reset" value="Clear the form">

The ACTION tells the form to send the information gathered to the processing script when the SUBMIT button is clicked. The NAME values will become variables when they reach the processing script. The input information becomes the variable values.

$to = "";

$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: " . $from . "\r\n";
$headers .= "Return-Path: " . $from . "\r\n";

if ( mail($to,$subject,$message,$headers) ) {
   echo "The email has been sent!";
   } else {
   echo "The email has failed!";

The $header area has been modified a bit from the previous examples. Since the form is gathering information from the visitor, this will enter the info and add the correct start and ending parts for the 4th mail variable.
Email - Headers << Email - Making Forms >> Email - HTML Emails

Advertise in the banner along the top, Click here!

Valid XHTML 1.0 Transitional Valid CSS! Text Link Ads