Live data from Hacker News

Email address validation: please stop

blog.sinjakli.co.uk

11–20 of 86 posts

Re: Email address validation: please stop

#12
post #6
post #2

I recently changed our email validation: all I do now is check for the existence of an "@".

Then why validate at all? Just send the user an email with an activation link. If it doesn't work and they're still logged into the site (with a limited account), then let them change their email address.

If you want your site to have a "login as guest" type feature that's one thing, but if an email address doesn't have an @ it will never work and it would be misleading to encourage people to check their email for a validation link.

People sometimes misread labels and enter their name on the line for their address. This would stop that.

Re: Email address validation: please stop

#13
While I agree that some kinds of validation are 'too eager' and annoying, just use a 'legit' e-mail address, ffs.

By including super-special characters and whatever extra features GMail or whoever provides, you're just asking for it, sorry.

Especially if you're a coder yourself, you can already assume that even if it passes the initial validation, it probably won't be properly stored or escaped when the actual mail is sent, when you try to log in with your address later, etc.

Re: Email address validation: please stop

#14
There are two separate issues going on here.

One: validating addresses to catch typos. A common example is typing a comma instead of a dot or typing just a username instead of a whole email address. Flagging these errors is a good thing.

Two: some developers believe that they can make people enter real email addresses by being very clever about only accepting strings that look like real email addresses. This is stupid, doesn't work, and often blocks legitimate addresses.

Re: Email address validation: please stop

#15
The "+" feature of gmail is great, but I hesitate to use it after some weird validation problems I've had. I've stopped asking that people validate properly, and started hoping that they a) don't validate or b) fail gracefully.

One (very important) site properly validated my "+" email address on the front end (gave me no errors), but the backend failed and I never received the required confirmation email... all resulting in a customer service call. Arggg.

Re: Email address validation: please stop

#16

While I agree that some kinds of validation are 'too eager' and annoying, just use a 'legit' e-mail address, ffs. By including super-special characters and whatever extra features GMail or whoever provides, you're just asking for it, sorry. Especially if you're a coder yourself, you can already assume that even if it passes the initial validation, it probably won't be properly stored or escaped when the actual mail i…

The relevant RFCs make it clear what is a correct eMail address. Why should we have to put with lazy or incompetent coders who can't be bothered to meet the standard?

Re: Email address validation: please stop

#17
post #12
post #6

Earlier quoted context omitted.

Then why validate at all? Just send the user an email with an activation link. If it doesn't work and they're still logged into the site (with a limited account), then let them change their email address.

If you want your site to have a "login as guest" type feature that's one thing, but if an email address doesn't have an @ it will never work and it would be misleading to encourage people to check their email for a validation link. People sometimes misread labels and enter their name on the line for their address. This would stop that.

Yeah exactly. It's more to catch wrong stuff entered in wrong field.

Re: Email address validation: please stop

#18
I like the idea of having validation but when the email doesn't match your pattern, give the user a warning that says "sorry, we don't think this is correct" but allow them to continue if they think it's legit, then have them click a link to validate so an incorrect email serves 0 purpose for them.

Re: Email address validation: please stop

#19
post #3

On the other hand, maybe the specification for email addresses is too loose.

Too loose for what though? To make it more useful as a communication format or to make it easier for developers to validate it? It's hard to believe that a tighter spec could have improved the former.

Re: Email address validation: please stop

#20

I tend to rely on http://www.regular-expressions.info/email.html when coming to validate an email address. I do often fall into the trap of trusting the framework's built-in email validation to be correct. Apparently, this is the regex to match RFC2822 (?:[a-z0-9!#$%&' +/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&' +/=?^_`{|}~-]+) |"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f]) ")@(?:(?:[a-z…

The problem with matching against the fully fledged RFC compliant regex is that not all email addresses are RFC compliant. As I indicated in my comment above, I've abondoned trying to "correctly" or "completely" validate email addresses. There's onyl one thing certain in an email address: it contains the "@" character.
Post reply on HN