On Thu, 10 Jul 2014 11:54:07 -0700
Bob goolsby <bob.gool...@gmail.com> wrote:

> Nota Bene:
> xxx....@zzz.www IS NOT the only valid format for an email
> address....  In this case, you really need to rethink your objection
> to using the proper CPAN module

*This*.

Use the well-trusted, battle-tested CPAN module.  Whatever you build
will likely be sub-par, and will let through invalid email addresses,
or, more likely, reject perfectly valid addresses you hadn't thought
about.  (Not casting any aspersions on your skill level - email
validation is notoriously tricky to get right!)

Note: you're testing for "valid looking" - the only way to know for
sure if an email address is actually OK is to send an email to it
and have them click a link.  With all the new TLDs coming out all the
time, you can no longer rely on a pre-set list of TLDs which exist -
new TLDs (some pointless, some uttterly stupid) are being released all
the time, and older email validation code that thinks it knows of all
TLDs which exist will reject perfectly valid email addresses.

(You can do some checks, for instance, does the domain part resolve
with an MX or A record; if not, it's probably not an email address you
want to accept.

However, even that could trip you up.

For example, "mickey mouse"@[127.0.0.1] is a valid email address :)


-- 
David Precious ("bigpresh") <dav...@preshweb.co.uk>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github




-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to