Re: Please can any one sugest or send me Email validation code.
Re: Please can any one sugest or send me Email validation code.
- Subject: Re: Please can any one sugest or send me Email validation code.
- From: Uli Kusterer <email@hidden>
- Date: Fri, 2 Feb 2007 09:58:41 +0100
Am 01.02.2007 um 15:47 schrieb Jim Thomason:
BUT - it's actually not -that- bad. For example, being a
do-it-yourselfer, I crafted a regex to match valid email addresses
myself for my perl module Mail::Bulkmail. It's "only" about 900
characters, I think.
Well, it also isn't as easy as most people think. Apple Mail for
example gets it wrong. It constantly complains about the e-mail
address of a friend of mine, simply because its user name ends with a
period. But luckily they were smart enough to let me "send anyway".
The problem is that email addresses can contain comments, and that the
blasted things can recurse infinitely.
Err... not quite. Not the addresses themselves can contain comments,
only the address fields in an RFC822 message header. So, to go from
the header value to a valid address, you need to parse out comments
and line breaks, but an actual address can't contain comments.
So, unless you're trying to correctly display an RFC822 message you
received from an outside source, you don't need to deal with wrapping
and comments at all. You just need to check for an "at" sign, a valid
TLD (or at least something that looks like one) and the correct range
of characters. It gets a tad harder if you have addresses on modern
servers that contain Punycode to encode Unicode characters, though.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden