Hello,

On 01/06/2004 01:52 PM, Dave G wrote:
        A while ago on this list I posted a few questions about an eregi
filter for email addresses entered into a form. With the help of people
on this list, I settled on the following code which has worked fine in
the months since I started using it. The code is this:

eregi('[EMAIL PROTECTED]', $email)

        But recently, a person was unable to get their email to pass
this eregi test. The email is valid, as they are able to send email to
me. It has the following format:

[EMAIL PROTECTED]

        Shouldn't this email pass? I've allowed for hyphens after the @
mark. Is it that there are two many periods?

No, your expression is really excluding many valid addresses. The RFC specify a much larger number of valid characters. You are also only allowing one possible dot in the domain name.


I think it is better to allow some possibly invalid sequences and then perform a DNS/SMTP based validation. In that case you may want to try this e-mail validation class that performs first a regular expression based validation with a more complete expression and then performs DNS/SMTP based validation.

http://www.phpclasses.org/emailvalidation

--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to