<form name="form1" method="post" action="sendcontact.php">
<table border="0" cellspacing="1" cellpadding="3" align="center">
<tr>
<td>Subject</td>
<td>:</td>
<td><input name="email_subject" type="text" id="email_subject" size="50"></td>
</tr>
<tr>
<td>Message</td>
<td>:</td>
<td><textarea name="client_message" cols="47" rows="7" id="message"></textarea></td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td><input name="client_name" type="text" id="client_name" size="50"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="client_email" type="text" id="client_email" size="50"></td>
</tr>
<tr>
<td height="58"> </td>
<td> </td>
<td align="right"><br />
<input type="submit" name="Submit" value="SEND"> <input type="reset" name="Submit2" value="CLEAR"></td>
</tr>
</table>
</form>
<?php
$email = $_REQUEST['client_email'];
// gets client's email address
$subject = $_REQUEST['email_subject'];
// gets client's subject message
$message = $_REQUEST['client_message'] ;
// gets client's message
$name = $_REQUEST['client_name'];
// gets client's name
$header="From: $name <$email>";
// combines client name and email address to create header
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) {
echo "<h2>Invalid email address Please Try Again</h2>";
echo "<a href='javascript:history.back(1);'>Back to Contact Form</a>";
return FALSE;}
/* validates correct email, if email is false the message "Invalid email address Please Try Again" displays with back link.
If
true mail will be sent*/
mail("youremailaddress@youraddress.com", $subject, $message, $header);
// mail function email's all info
print "Your email has been sent";
?>