3 ms·
I never understood the point of enforcing the spec for user input. Even if done properly it may reject some working, but invalid email addresses. And it does no
by aneth 16y ago
I never understood the point of enforcing the spec for user input. Even if done properly it may reject some working, but invalid email addresses. And it does nothing to increase your chances of getting a good email address. Your user is either willing to give you their real address or not. If they are willing, validating fully does not protect against typos and if they are not you will get a well formattd fake address - validating to spec serves no purpose and possibly harms. Just don't do it.
Check for an @ sign and possibly a top level domain name (at leasr one dot) and be done with it.
- hammock 16y agoMost forms I have seen validate this way - or at the most, check for x@x.x Agree that anything beyond this may be a little overzealous- the real purpose and value of email validation is to help the form-filler discover typos/mistakes, to make sure you reach your willing customer. I can see though how some programmers would be tempted to distort this goal into the goal of having "a clean database." (Although worthy, but not the end goal)
- JoachimSchipper 16y agoSome really broken/misconfigured mailer software may still accept the 'foo@bar@qux' syntax (route mail for user foo@bar via qux, or the other way round - I forgot which, since no sane system has implemented this since the word 'spam' came to mean bad e-mail.) So there may, theoretically, be some value in checking for the presence of exactly one @.
- ZoFreX 16y ago@'s are fine as long as they are escaped properly!