Live data from Hacker News

How faulty checking for valid email addresses can hurt you

blog.ox.cx

11–18 of 18 posts

Re: How faulty checking for valid email addresses can hurt you

#12
post #10

There's no way to get around invalid email addresses. Anybody can put in something like asdhsouhdosd@ahsoufhsdof.com and it would pass most regex checks. I think the best solution is to just check for an "@" sign and a "." after it.

Yup, I deal with a lot of email data at work and this is pretty much what I do. People try to get way too clever with their validation (I pity anyone stuck with an email at a .museum TLD), and the spambots will just put real-looking fake ones anyway.

Re: How faulty checking for valid email addresses can hurt you

#13
post #4
post #2

My current policy on validating email addresses is to issue a warning if a given email address fails a check against a standard that covers the vast majority of addresses in use. Validating against the whole range of possible address content is near pointless. The warning simply asks the user to check their email in case of errors but allows a page submission following the display of that warning.

My current policy on validating email addresses is to issue a warning if a given email address fails a check against a standard that covers the vast majority of addresses in use. My policy on validating email addresses is "if I send you an email and it arrives, your email address is valid". Why do you need to "validate" an email address? Knowing that an address is syntactically valid doesn't do anything to confirm th…

"Knowing that an address is syntactically valid doesn't do anything to confirm that it will reach the intended target."

However, knowing that an address is syntactically invalid does confirm that it won't reach the intended target. If you don't mess up the validation.

Might be better than having the user wait infinitely for an important transactional email that will never arrive because of a dumb typo.

Re: How faulty checking for valid email addresses can hurt you

#14
post #11

We check for an MX record associated with the domain, and leave it at that. I'd rather deal with spam than lose a customer.

a domain without MX records is valid. if a domain/host doesn't have an MX record, MTAs are supposed to try delivering to the domain/host itself.

Re: How faulty checking for valid email addresses can hurt you

#15
post #14
post #11

We check for an MX record associated with the domain, and leave it at that. I'd rather deal with spam than lose a customer.

a domain without MX records is valid. if a domain/host doesn't have an MX record, MTAs are supposed to try delivering to the domain/host itself.

Thanks for the tip, I didn't know that. We should change to checking for valid DNS entries then.

Re: How faulty checking for valid email addresses can hurt you

#17
post #9
post #2

My current policy on validating email addresses is to issue a warning if a given email address fails a check against a standard that covers the vast majority of addresses in use. Validating against the whole range of possible address content is near pointless. The warning simply asks the user to check their email in case of errors but allows a page submission following the display of that warning.

Mine is not to re-write the wheel. Writing a correct email address is indeed non-trivial, but there's at least one well known module written by someone who's actually read the RFCs and won't trash users using plussing and minusing. Use that, don't write your own.

Depends on your customer base. It might be better to reject one show-off who managed to put a backspace in his email in return for helping 1000s of customers who enter www.name@aol.com

It's possible to have a 6 character email address, but for most users checking that they have entered more than 6 chars would be good.

Post reply on HN