It's Impossible to Validate an Email Address
31–40 of 68 posts
Re: It's Impossible to Validate an Email Address
#32If you were to ask me for a regex, I'd say /.+@.+/. That's the easiest and most accurate way to do it by regex. Sure, some invalid addresses may still get accepted, but that is unavoidable. Even the most thorough validation[0] is going to accept nonexistent addresses. [0] Except those that validate by sending a mail to it. Sending an email is the only way to be sure.
# get email addresses grep -EiEio '\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b' # censor email addresses sed -r 's/( )/\1--removed--\2/g' If email doesn't meet those, I drop them on the floor. Then again, I drop email on the floor for lesser reasons.
Re: It's Impossible to Validate an Email Address
#33I once heard the story of a man who helped Aruba set up their DNS (.aw) in the late 90's. In exchange, as part of his compensation, he asked for an email address at the top-level domain, and received something like js@aw, which is a perfectly functional email address, but trips up a lot of validators.
It isn't a valid address. TLDs must not resolve, so it should be impossible to make a server handle it (yet, it is mostly possible, because most DNS servers do not completely implement the RFCs - still, there's no guarantee it will work on every network).
It has an MX record too. There is nothing wrong with this.
Re: It's Impossible to Validate an Email Address
#34If you happen to control the web page where the user is entering the email, this little piece of code has been a godsend for us: https://github.com/mailcheck/mailcheck I agree with the idea that it's impossible to validate. But, mailcheck takes the approach of seeing if the email is potentially wrong, then prompting the user with what it thinks they meant. It's usually right, but if not, it allows whatever the user w…
There were a number of other checks (being close to yahoo.com or gmail.com or other common email hosts, containing surprising characters, etc) that would trigger warnings, but still allow the check to pass if the user assured us it was correct.
Re: It's Impossible to Validate an Email Address
#35What I'm about to say is more general than regex, but can online services please stop trying to validate my email address? If I gave you an email address that you think is invalid, rest assured I did it for a reason. I'm not an imbecile: I know how to type my address correctly (especially when you make me type it twice). For all the imbeciles who don't know how to type their address correctly, the phone system still…
Now we can talk about HOW validation is implemented, and I think it would be completely fair to raise a warning: "Hey, did you mean to enter this?" instead of "sorry, nope." when non-trivial addresses are encountered.
Re: It's Impossible to Validate an Email Address
#36If you were to ask me for a regex, I'd say /.+@.+/. That's the easiest and most accurate way to do it by regex. Sure, some invalid addresses may still get accepted, but that is unavoidable. Even the most thorough validation[0] is going to accept nonexistent addresses. [0] Except those that validate by sending a mail to it. Sending an email is the only way to be sure.
How about "one@two@three@four@example.com"?
Re: It's Impossible to Validate an Email Address
#37I once heard the story of a man who helped Aruba set up their DNS (.aw) in the late 90's. In exchange, as part of his compensation, he asked for an email address at the top-level domain, and received something like js@aw, which is a perfectly functional email address, but trips up a lot of validators.
It isn't a valid address. TLDs must not resolve, so it should be impossible to make a server handle it (yet, it is mostly possible, because most DNS servers do not completely implement the RFCs - still, there's no guarantee it will work on every network).
tk has address 217.119.57.22
cf mail is handled by 0 mail.intnet.cf.
to has address 216.74.32.107
io mail is handled by 10 mailer2.io.
gg has address 87.117.196.80Re: It's Impossible to Validate an Email Address
#38If you were to ask me for a regex, I'd say /.+@.+/. That's the easiest and most accurate way to do it by regex. Sure, some invalid addresses may still get accepted, but that is unavoidable. Even the most thorough validation[0] is going to accept nonexistent addresses. [0] Except those that validate by sending a mail to it. Sending an email is the only way to be sure.
# get email addresses grep -EiEio '\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b' # censor email addresses sed -r 's/( )/\1--removed--\2/g' If email doesn't meet those, I drop them on the floor. Then again, I drop email on the floor for lesser reasons.
Re: It's Impossible to Validate an Email Address
#39If you were to ask me for a regex, I'd say /.+@.+/. That's the easiest and most accurate way to do it by regex. Sure, some invalid addresses may still get accepted, but that is unavoidable. Even the most thorough validation[0] is going to accept nonexistent addresses. [0] Except those that validate by sending a mail to it. Sending an email is the only way to be sure.
Absolutely this. The check for an '@' and something before/after it is for sanity, and anything beyond that would involve actually trying to use the address.
Re: It's Impossible to Validate an Email Address
#40The weirder it is the fewer web forms or software you'll successfully put it into.
I think we can just say no, functionally, you cannot put comments or additional @ symbols into your email address. It hasn't worked for long enough, people know you just aren't supposed to do it. I'd be surprised if you were allowed to create such a thing signing up for bing for example. You probably need to be the administrator of some chaotic UNIX server with full DNS, in order to force it to happen at this point.
Even Google Chrome's built in email field validation doesn't allow you to do it.
I shouldn't be expected to jump through the hoops necessary in order to allow "technically valid" email addresses that someone went out of their way to make, when I could more easily suggest they use a normal one.