3 ms·
The email address validation is incorrect. Neither test+foo@gmail.com, test+foo@gmail.com., test@io, test@io., test@::123, test@[::123], or test@[::123]:456 are
by Sephr 16y ago
The email address validation is incorrect. Neither test+foo@gmail.com, test+foo@gmail.com., test@io, test@io., test@::123, test@[::123], or test@[::123]:456 are accepted, and likely other cases. I suggest you take the easy route and just only check `emailAddress.indexOf("@") !== -1`.
- merijnv 16y agoThis point should really be made more to web developers. Nothing annoys me like yet another website which tells me myname+filter@example.com is not a valid address and ruins my nice mail filtering...
- giu 16y agoOr have a look at the full RFC 2822 regular expression for matching email addresses: http://code.iamcal.com/php/rfc822/full_regexp.txt http://code.iamcal.com/php/rfc822/full_regexp.txt I'd personally stick with Sephr's advice, though ;-)
- dfox 16y agoThere are SMTP addresses that are perfectly valid, non-local and yet does not contain '@'. But in practice that could be probably ignored. But if you want to verify email address, then going with must contain '@' is probably one of the more reasonable routes (you should probably also ban few characters like newlines and ';').