From the perspective of a user typing their own email address correctly, I use text substitution on OS X and iOS to never type my full email address. ex fg --> foo@gmail.com
The Correct Way to Validate Email Addresses
11–20 of 405 posts
Re: The Correct Way to Validate Email Addresses
#12https://github.com/kdisneur/email_checker
It breaks down into 3 parts that can be used either independently or as a whole: format, MX and SMTP.
Re: The Correct Way to Validate Email Addresses
#13With no validation other than sending the email, you have to know, for example, what the server would do with an email address that claims to be @localhost. Now it becomes a problem- or at least a question and concern- for the backend system. Whether the backend interprets root@localhost as valid and does exactly what it's told or rejects it due to some configuration- it has become a backend complication and a DOS attack vector.
A simple policy of only handling a subset- the common class of email addresses- is one of the things that allows us to have a simple mental model of what the MTA is supposed to do. The fact that it sometimes caught a type-o, or not, is incidental. "Invalid email" wasn't meant to imply the email address doesn't fit the spec- it was meant to imply that a particular site or service has chosen not to accept email addresses like that.
Or at least that's what I assumed :-)
Re: The Correct Way to Validate Email Addresses
#14Earlier quoted context omitted.
Also relevant was, "If you have a well laid-out form with a label that says “email”, and the user enters an ‘@’ symbol somewhere, then it’s safe to say they understood that they were supposed to be entering an email address." In other words, it does make sense to check that they entered an '@' symbol somewhere, since it shows that they understood it was an email field. Any 'validation' beyond that is useless.
How about more than one @ sign? Does the email address spec exclude the possibility of more than one @ symbols?
Re: The Correct Way to Validate Email Addresses
#15Earlier quoted context omitted.
Also relevant was, "If you have a well laid-out form with a label that says “email”, and the user enters an ‘@’ symbol somewhere, then it’s safe to say they understood that they were supposed to be entering an email address." In other words, it does make sense to check that they entered an '@' symbol somewhere, since it shows that they understood it was an email field. Any 'validation' beyond that is useless.
How about more than one @ sign? Does the email address spec exclude the possibility of more than one @ symbols?
Re: The Correct Way to Validate Email Addresses
#16Those of us with firstnamelastname@commonhost will appreciate not getting bills and job offers and such.
Re: The Correct Way to Validate Email Addresses
#17Earlier quoted context omitted.
Also relevant was, "If you have a well laid-out form with a label that says “email”, and the user enters an ‘@’ symbol somewhere, then it’s safe to say they understood that they were supposed to be entering an email address." In other words, it does make sense to check that they entered an '@' symbol somewhere, since it shows that they understood it was an email field. Any 'validation' beyond that is useless.
How about more than one @ sign? Does the email address spec exclude the possibility of more than one @ symbols?
Re: The Correct Way to Validate Email Addresses
#18Re: The Correct Way to Validate Email Addresses
#19* somename@gmail.co
* anothername@yhoo.com
* myemail@hotmial.com
These are very common errors that occur nearly every day. A regex isn't going to help here. What does help, is a notification that asks people to verify what they typed –– if the email contains an obvious, common error, such as one listed above.
Re: The Correct Way to Validate Email Addresses
#20Email addresses aren't a special enough case to be handled differently than any other user input, which we always validate to both sanitize and show client-side errors, if nothing else.
Sure, the complete regex is complex, but it is defined and is hardly unconquerable. Look at Django's `EmailValidator` implementation for example [0] that is mature and well tested [1].
The author has not convinced me that ignoring validation is the right choice when options with a scope so thorough exist.
[0]: https://github.com/django/django/blob/master/django/core/val...
[1]: https://github.com/django/django/blob/a9215b7c36bff232bcc941...