Email Php

header("Content-type: text/vnd.wap.wml");
echo "\n";
$recipient_mail = "webmaster@yourdomain.com";
$recipient_name = "Webmaster";
$sender_name = "WapMail";
$sender_mail = "wapmail@yourdomain.com";
$subject = "News Letter Subscription";
$message = "News Letter Subscription\n\n";
function CheckEmail ($email) {
$error = FALSE;
# -- note first blank is a placeholder
$punctuation = " ~!#$%^&*()+|{}[]:;?<>,/?\\\'\"";
$strpos = strpos($email,"@");
if (!$strpos) {
$error = TRUE;
} elseif (strpos($email,"@",$strpos +1)){
$error = TRUE;
} else {
for ($i = 0; $i < strlen($punctuation); ++$i) {
$error = strpos($email,$punctuation[$i]);
if ($error > 0) {
$test = isset($error);
$error = TRUE;
break;
}
}
}
if (!$error) {
list($user,$domain)= split("@",$email,2);
$arr = explode(".",$domain);
$count = count($arr);
if (strlen($user) < 1) {
$error = TRUE;
} elseif ($count < 2) {
$error = TRUE;
} elseif (strlen($arr[$count-1]) < 2) {
$error = TRUE;
} elseif (strlen($arr[$count-2]) < 2) {
$error = TRUE;
}
}
return ($error);
}
?>







Newsletter Subscription



Please ener information below

First Name



Last Name



E-mail Address



[Submit]





?
[Home]

$error = FALSE;
$errtxt = "";
if (empty($fname)) {
$error = True;
echo "First Name is blank
";
}
if (empty($lname)) {
$error = True;
echo "Last Name is blank
";
}
if (empty($email)) {
$error = True;
echo "E-mail is blank
";
} elseif (CheckEmail($email) ) {
$error = True;
echo "Invalid E-mail address
";
}
# If passed edit display thanks and send mail
If (!$error) {
echo "Thanks your subscription has been entered.";
$message .= "First Name : " . $fname . "\n";
$message .= "Last Name : " . $lname . "\n";
$message .= "E-Mail : " . $email . "\n";
$message .= "Entered : " . date("m/d/y h:i") . "\n";
mail("$recipient_name <$recipient_mail>","$subject","$message",
"From: $sender_name <$sender_mail>\nReply-To: $sender_name
<$sender_mail>\nContent-type: text/plain\nX-Mailer: PHP/" . phpversion());
} else {
echo "Press back to correct errors.
";
echo "";
}
?>