On 3 Nov 2005, at 04:32, viraj wrote:

does PHP really needs a function to validate an email address!! i
doubt. because PHP is a language which provides number of string
functions with regex capabilities to develop what ever pattern
matching you want.

Writing a regex for RFC2822 is not easy - the format is extremely flexible. Having said that, I've got on very well using these:

http://www.hexillion.com/samples/#Regex

Though it doesn't deal with that oddity that Richard mentioned.

The PEAR rfc822 class is pretty good, but it should be noted it's designed for parsing entire to, cc, bcc fields which may contain multiple addresses, and it's not quite as simple as asking it 'is this address ok'.

second point is, different organizations have different policies on
validating email addresses, so again those developers have to mend
their own mechanisms. so everybody will not benefit this effort.

Well, unless you're counting really different addressing standards like X.500, everyone has to operate within RFC2822. You're quite free to put additional constraints on addresses, but should be within that spec, not in addition to it. If an address is not RFC2822 compliant, it's pretty unlikely to work, though I have occasionally seen things like non-ASCII chars and '_' get through.

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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

Reply via email to