mail and eregi problem
| From: | Nikola Karović | Date: | Sat, 27 Oct 2001 20:34:08 +0000 |
| Subject: | mail and eregi problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-72589@lists.php.net to get a copy of this message | ||
Hi,
I'm having some trouble with this formToEmail script. It shuld take
variables from html form, send them to me, and then send auto reply to the
person who filed the form. But the problem is that, if the person dont enter
e-mail, or enter "sjhdfzg" or leave empty, i receieve internal server error.
I've looked for some functions, and found some eregi, that can cehck e-mail
before sending. I just dont know how ti aply it. here is the code:
<first mail>
@mail($toemail, $subject, $linetot1, "From: $name <$email>\nContent-Type:
text/plain; charset=windows-1250");
<second mail> The problem one with this function
function validEmail($email) {
if
(eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}
", $email))
@mail($email, $subject, $linetot2, "From: $toname <$toemail>\nContent-Type:
text/plain; charset=windows-1250");
}
Thanks!