Hello,
I have created a form mailer that works well except the email checker does not work. I have gotten rid of all the other code in this message so that all you need is the part were it checks the mail (for convinience). The problem is that all email addressess are considered valid, even unvalid ones! Any help would be greatly appreciated.
function show_form() {
?>
<html>
<body>
<?php
if($emailaddr) {
echo "<input type=\"text\" name=\"emailaddr\" value=\"$emailaddr\" size=\"28\">";
} else {
echo "<input type=\"text\" name=\"emailaddr\" size=\"28\">";
}
?>
</body>
</html>
<?php
}
// NOW HERE IS THE PHP TO CHECK THE CODE //
function send_message() {
function emailcheck($intext) {
$theresults = ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $intext, $trashed);
}
$check = emailcheck($emailaddr);
if(!($check))$errors .= "- The specified email address is not valid! Please specify a valid email address!<br>";
}
It verifies everything. Even bad addressess!