File
Name: mail_test.php
<form name="email"
method="post" action=”mailscript.php”>
<p>Name
: <input type="text" name="name" /></p>
<p>E-mail
:<input type="text" name="email" /></p>
<p>Subject
:<input type="text" name="subject" /></p>
<p>Message
: <textarea name="message" cols="25"
rows="5"></textarea></p>
<p><input
type="reset" name="reset" value="Reset" /> ||
<input name="submit" type="submit"
value="Submit" /> </p>
</form>
File
Name: mailscript.php
<?php
$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$message=$_POST['message'];
if($name!=""
&& $subject!="" && $message!="") {
if($email!="") {
if(preg_match("/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})+$/",$email))
{
$to
= "engr.lukman@gmail.com";/* Reciptionist email */
$where
= "Email received from Choukosh ";
echo
"<h2>Email Delivery Report:</h2>";
echo
"<h3>Thank You - $name</h3>";
echo
mail($to,$where,"Name : $name\r\nSubject : $subject\r\n Message :
$message","From:$email");
echo
"<h4>As soon as possible communicate to you !</h4>";
}
Else
{
echo
"<h1 align=\"center\" style=\"color:red\">Valid
email enter please !!</h1>";
}
}
else
{
echo
"<h1 align=\"center\" style=\"color:red\">Email
should not empty please !!</h1>";
}
}
else
{
echo
"<h1 align=\"center\" style=\"color:red\">Mail
not send successfully !</h1>";
}
?>