Skip to content

Comment on A curated list of falsehoods programmers believeparent

Comments

All that said, there are a number of really good email validators out there in the wild.

One of the oldest can be found at http://isemail.info/about, (along with a test suite to write your own implementation and some sage advice about the basic approaches it's reasonable to take when validating email addresses).

Yes, dependencies aren't completely free conceptually, even when they're distributed free of charge, but why write a crappy validator of your own when there are really good ones available?

Because I really don't want to accept a string with more (or less) than one @ symbol for an e-mail address. Such an address can be valid theoretically but chances are it is incorrect. If somebody submits such a string for their email, 99 in 100 cases it's a typo and the remaining 1 is a person testing you. Not even one real person in a million will use an e-mail address which doesn't have exactly one @ symbol in it.

People can also incorrectly type in their email in a way that looks fine, so I'm skeptical of intentionally not allowing valid email addresses just to cut out a small fraction of those. The isemail.info site recommends a warning if it doesn't look right, but allowing the user to override and use anyway, which seems sensible to me.

(I say this as the proud owner of a lastname.email domain, where the .email TLD was made explicitly for this 8 years, and I still have problems with bad validation.)

You can ask for confirmation if it’s an unusual construction, but denying it outright is user hostile.

Also, how many users are actually manually typing their e-mail address into a form, instead of using autofill?

As the referenced page says, a valid email address is one that can receive email. If you really care about the e-mail address being correct, then you need to validate it by sending a verification e-mail.

If somebody wants to register and use an email address with a bang path, that unix beard is out of luck.

Is there a reason to validate an email address? Even if it is valid, you can't use it for anything until you check that the right person owns it and is able to read mail you send there.

I personally accept any string that is between 3 bytes and 1 kilobyte, if they click the link in it then it's good.

Yes - you validate the email address to improve your UX.

It reduces the odds of the user giving you a wrong email address then having to either jump through more hoops to get signed up or give up.

You're absolutely right that the acid test is "can they receive email to it?"

For UX purposes you would use a warning/extra confirmation. If you make the decision to block the user from registering, you are doing something else.

Yeah, precisely.

As that website I linked says, if the email looks suspicious but is technically valid, ask them "Are you sure you didn't mean this?", but let them choose what they put in.

However, if the address as given is definitely invalid, then you can reject it and explain why. You can offer suggestions here too if any seem reasonable.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.