4 ms·
> or a valid email regexp In terms of standards, there's not a whole lot you can do beyond validate the domain if it includes one. You can take the HTML5 appro
by mnarayan01 9y ago
> or a valid email regexp
In terms of standards, there's not a whole lot you can do beyond validate the domain if it includes one. You can take the HTML5 approach (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#Basic_validation https://developer.mozilla.org/en-US/docs/Web/HTML/Element/in...), but that means leaving out at least theoretically valid email addresses.
- majewsky 9y agoHuh? RFC 2822 describes in detail what a valid email address looks like. (There might be newer ones superseding it; that's the one that was current back when I looked into this topic.) In practice, a lot of theoretically valid email addresses are rejected by implementations, e.g. my favorite: "@"@example.com What's true, of course, is that you should never rely on an email address being syntactically correct. You should only use it after having done a validation process that involves sending mail to that address.
- mnarayan01 9y agoI agree with everything you're saying (though my favorite is probably addresses containing newlines). My point is just that in practice it's not terribly useful, e.g. why HTML5 defines its own: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address https://html.spec.whatwg.org/multipage/input.html#valid-e-ma....