News for hackers. Stuff that matters.
Re:Complexities of e-mail validation logic by ds on Monday May 24, 2021 @10:46AM (#27264948)
If your email is <RFC>fan 69™@root I am not going to let you signup. Sending emails cost money and bouncing emails affects your sender reputation. Also, for every user out there using <RFC>fan 69™@root as their email address, there is going to be thousands of people accidently entering their email address incorrectly and not getting a alert about it. Yes you could do fancy shit like checking mx records and whatnot, but come on- Im not going to maintain/build that infrastructure for the one out of a million people who are trying to use that address.

Developer time is precious at a startup and supporting <RFC>fan 69™@root while still denying b ob@gmailcom is very, very far down the list of things to do.

In summary: I don't suggest doing 'perfect' email validation to RFC spec. You will save money/devtime and make more of your users happy by not doing it.

Re:Complexities of e-mail validation logic by paulmd on Monday May 24, 2021 @01:08PM (#27266943)
This sounds great but what you think is "common" probably isn't.

When I was validating myself for Amazon Prime Student, I literally had Amazon refuse to accept my student email in the form [email protected] because there were two '.'s in the mailbox portion. I had to send an email to support and it was eventually dutifully fixed.

And that's not an uncommon format for, you know, school emails. And that's an Amazon engineer who should have known.

I imagine there's developers who think "domain.tld" is the only thing valid to put in the domain portion, and that's going to fail with "domain.co.uk", or uncommon TLDs, or other perfectly valid constructs. And sure "it's only x% of the users" but it's a pain in the ass if you're that user. You need to be reasonably permissive.

(but on the other hand "myname@..." is not valid either, and that will fail and cost you money as well... hence leading us back to 'just follow the spec')

Re:Complexities of e-mail validation logic by incrudible on Wednesday May 26, 2021 @05:45AM (#27288308)
This is a false dichotomy. Supporting dots in the email address is trivial, following the spec is not.

Furthermore, for a user, it is trivial to get another email address if the one they have causes issues, so it is not really an accessibility issue either.

Re:Complexities of e-mail validation logic by WindyLakeReturn on Monday May 24, 2021 @11:39AM (#27265624)
It depends upon where you are validating email input at.

For the initial email input, your logic works fine. Once it is applied downstream in a process, it begins to get messy. Someone might do an incorrect email validation that happens to block emails that you have already accepted or which you are importing from a valid source. Someone has already given the example of a login field not allowing them to use the email they signed up with. If such upgrades occur later in a projects life cycle, not only might you have to spend developer's time, you may also have a production outage.

Personally, I suggest using some, even if imperfect, validation when gathering the email initially (for the reasons you point out) and then not validating that information any further.

Re:Complexities of e-mail validation logic by paulmd on Monday May 24, 2021 @01:11PM (#27266970)
I actually run into this all the time with passwords using a password manager. Lots of places will accept the creation of a password that's long/complex/etc but then when you actually try to log in with it it won't accept a long password, won't accept certain characters, will silently truncate it and throw an invalid password error, etc.

Sometimes disabling Javascript will fix it, sometimes not. I occasionally have resort to using "I forgot my password" until I figure out what the actual underlying requirements of the passwords are.

Re:Complexities of e-mail validation logic by zerd on Monday May 24, 2021 @01:58PM (#27267600)
Etrade lets you create 32 character password, but if you enable 2FA you suddenly can't login because apparently they concatenate them together and then check the length. So make sure your password is max 26 characters. (they might've fixed this but I haven't tried).
Re:Complexities of e-mail validation logic by sbierwagen on Monday May 24, 2021 @02:45PM (#27268153)
Like GP mentioned, Etrade also does the thing where it accepts the . character on password creation, but not login. That was fun to figure out.
Re:Complexities of e-mail validation logic by hsbauauvhabzb on Monday May 24, 2021 @05:14PM (#27269794)
Curious, can you login with 26 characters and your MFA seed to bypass MFA entirely?
Re:Complexities of e-mail validation logic by lcuff on Monday May 24, 2021 @01:17PM (#27267055)
Yup! Same thing with the ridiculous verify-my-identify questions. One I encounter all the time is the local community college, which let me use spaces in my answers on creation, but not at entry time. Grrrr.
Re:Complexities of e-mail validation logic by zxcvbn4038 on Tuesday May 25, 2021 @07:10AM (#27275384)
That happens too often! A lot of places where I try to use a really long password will silently truncate it, but different forms will truncate at different lengths, so what might work for registration might not work for login or changing the password later.

I’m always suspicious when sites cap passwords at < 32 characters, that almost always means it’s being stored in a reversesble format someplace - maybe encrypted, maybe obfuscated, or maybe not either (banks).

The sites I really trust don’t care how long your password is because their hash size is fixed. The only real length consideration might be that if a bunch of people send obnoxiously long passwords at the same time and they are using bcryprt or scrypt it might stress the server’s cpu, so they might put an upper limit to prevent that.

Re:Complexities of e-mail validation logic by citycide on Tuesday May 25, 2021 @10:15AM (#27277014)
I ran into this with Sony's PlayStation site. I generated a passphrase that the registration form allowed but from then on I was unable to access my account. I went through the same trial as you and found that they were truncating the password to something like 16 characters. That was just this past year, so I'm pretty sure it's still that way.
Re:Complexities of e-mail validation logic by CodeMage on Monday May 24, 2021 @01:57PM (#27267584)
As a user, I got burned by that several times. Now, when I create a new account somewhere, the first thing I do is log out and try to log back in.
Re:Complexities of e-mail validation logic by feanaro on Monday May 24, 2021 @01:30PM (#27267215)
I don't encounter this very often myself. So far the only place I've seen this is Paypal. facepalm
Re:Complexities of e-mail validation logic by fomine3 on Monday May 24, 2021 @09:39PM (#27271786)
<input type="password" maxlength="xx"> must be illegal. It can't be noticed whether is input truncated.
Re:Complexities of e-mail validation logic by novok on Monday May 24, 2021 @04:56PM (#27269601)
I've run into this with labcorp. Their desktop webapp takes subdomain emails, but their mobile iOS health webpage login thinks a subdomain email is invalid and disables the login button. They also don't let you change your account email so you can never really fix this issue properly.
Re:Complexities of e-mail validation logic by NikolaNovak on Monday May 24, 2021 @05:39PM (#27270031)
I get your point, but it ends up pretty arbitrary who picks up what part of spec to implement / which part of spec they deem "common sense".

e.g. It drives me BONKERS how many systems absolutely reject my single-letter email (~"[email protected]"), which I created specifically to make it easy and safe to type on mobile devices etc. Others will reject the "+" sign, or underscore, or dot/period, or (brilliantly) two periods or underscors, etc etc etc :=/

Re:Complexities of e-mail validation logic by Strom on Monday May 24, 2021 @06:30PM (#27270448)
There are also blacklists for names you can use. My real e-mail is [email protected] but Facebook doesn't allow me to use that e-mail, warning me that only personal e-mails are allowed. Paradoxically I ended up using my work e-mail to get around the restriction.
Re:Complexities of e-mail validation logic by AgentME on Monday May 24, 2021 @09:15PM (#27271649)
Agreed. Anyone that decides to come up with a "common sense" subset of emails to allow is more likely to accidentally block some perfectly normal addresses than actually accomplish something useful. I remember I once made this point in an HN thread, and I got a very dismissive and overconfident reply by someone who posted a regex that turned out to block my own email address (which had a number immediately before the @ symbol).

Writing code that doesn't need to exist that has a possible failure mode of not letting someone sign up at all is just a bad decision. If you're going to write that code, either go through the effort of getting it completely right or soften the failure mode. If you really think the user is somehow mistyping their email with special characters or an unusual TLD, then you could show them a non-blocking warning message.

Re:Complexities of e-mail validation logic by hwbehrens on Monday May 24, 2021 @06:17PM (#27270347)
My email address ends with the .cc TLD, and the number of websites which say "Did you mean to type .ca?" and then refuse to let me continue without changing it drives me similarly batty.
Re:Complexities of e-mail validation logic by skissane on Monday May 24, 2021 @10:18PM (#27271980)
Maybe what we need is a narrower standard that subsets RFC5322 to remove (or at least deprecate) rarely used address syntaxes, such as double-quoted local parts.

(Actually RFC5322 already deprecates some syntaxes. For example, "John Hacker"."Ph.D., Esq."@example.com is a deprecated syntax (obs-local-part), because it contains multiple quoted-string components separated by dots.)

> or (brilliantly) two periods or underscors

Two or more consecutive periods is actually disallowed by RFC5322 (unless quoted). [email protected] is a valid address, [email protected] is not. ("foo..bar"@example.com is however)

Re:Complexities of e-mail validation logic by ivan888 on Monday May 24, 2021 @07:17PM (#27270833)
I don’t even have anything weird going on with mine other than using my own domain with a less common 2 letter country code TLD, but it gets me rejected from signing up to at least a few services per year
Re:Complexities of e-mail validation logic by mobjack on Monday May 24, 2021 @08:48PM (#27271481)
Customer complaints usually determine the spec.

If enough people wrote in about not accepting one letter email addresses, then they would likely update the validation.

But if customer service tells users to use another email address in that scenario and the customer does that, then it might not be worth the effort to fix it.

Re:Complexities of e-mail validation logic by bombcar on Monday May 24, 2021 @10:20PM (#27271983)
It’s getting to where if you support @gmail.com and no other you’d still get 80% of signups.

Better to warm an email doesn’t look right, but let them continue if they want to

Re:Complexities of e-mail validation logic by labawi on Tuesday May 25, 2021 @04:53PM (#27282493)
I think it's more likely the marketing department doesn't like people leaving fake addresses.

When I want to check postage or whatever, and they require an email address, [email protected] typically doesn't work, but [email protected] does.

Re:Complexities of e-mail validation logic by josephcsible on Monday May 24, 2021 @10:56AM (#27265090)
This logic is why so many Web sites today won't let you use a plus sign in email addresses, which ruins a really nice Gmail feature.
Re:Complexities of e-mail validation logic by kyrra on Monday May 24, 2021 @11:19AM (#27265370)
As people said, true spammers know to just strip off the "+" in the email address. This is actually a fun reason to set up your own domain and set up email forwarding for *@example.com to go to your main gmail or whatever account, then the "username" part of the email I just set to the domain of the account I'm signing up for. So I'll use [email protected] when signing up at Amazon (or whatever site).
Re:Complexities of e-mail validation logic by rootusrootus on Monday May 24, 2021 @11:27AM (#27265487)
> So I'll use [email protected] when signing up at Amazon

I go a little farther. I figure an attentive spammer might figure out that if I use [email protected] to sign up for Amazon, I may have exactly the scheme where *@johnsmith.net will work, so they can just add that to the spam list as a wildcard and pick a new address every time. So instead, I use [email protected], john102, john103, etc, to try and obscure my strategy and prolong the life of the domain forwarding.

Re:Complexities of e-mail validation logic by typicalbender on Monday May 24, 2021 @12:58PM (#27266781)
Hard truth is you're not worth enough for a spammer to look for that pattern, it's a numbers game and you're just making it harder on yourself.

Also unless you're keeping a lookup table you're losing a great benefit of the wildcard. You can, and I have caught a few places, tell when a company sells your email. If I get an email from company XYZ to my email [email protected] I know exactly who sold my email and to whom.

Re:Complexities of e-mail validation logic by rootusrootus on Monday May 24, 2021 @01:34PM (#27267282)
I agree that I'm probably not worth the effort, but if this kind of domain wildcard strategy were to become more popular it is entirely feasible for a rudimentary machine learning algorithm to detect its use.

> unless you're keeping a lookup table you're losing a great benefit of the wildcard

That's true, I don't keep a lookup table per se, though I do have a deleted items folder that I could look back in. I'm not sure what I would do, though, if I knew what particular company sold my email address? Send them a nastygram they will just ignore? I just block the address and move on.

Re:Complexities of e-mail validation logic by labawi on Tuesday May 25, 2021 @04:09PM (#27281940)
I think a typical spammer doesn't care much about such users, but if given given a choice they would rather avoid such users.

AFAIU, most buld spam is targeted on gullible or vulnerable people. The spam is often terrible on purpose.

Sophisticated or targeted attacks are a different category and they may be a good reason to prefer something non-guessable.

Re:Complexities of e-mail validation logic by willcipriano on Monday May 24, 2021 @11:33AM (#27265548)
I just have a entire domain for the purposes of spam. Anything sent to there ends up in my bulk folder. I use [email protected] so I can tell who sells my email or gets hacked. Never noticed someone trying to send a email to any addresses I haven't previously used.
Re:Complexities of e-mail validation logic by wastholm on Monday May 24, 2021 @11:59AM (#27265928)
> Never noticed someone trying to send a email to any addresses I haven't previously used.

At least a few years ago, I noticed a lot of spam to <random first name>@<my domain> -- i.e., completely made-up addresses that I had never used. Since messages sent to those addresses were guaranteed to be spam, I started treating them as free training data for the spam filter.

I don't know if this still happens, though, because I haven't looked.

Re:Complexities of e-mail validation logic by Grollicus on Monday May 24, 2021 @12:19PM (#27266199)
This is currently happening to my email domain. Gets rejected as it doesn't have a valid hash (recipient name), but the logfiles are full of <3 letters>@mydomain.com and <english_word>@mydomain.com rejections.
Re:Complexities of e-mail validation logic by klyrs on Monday May 24, 2021 @12:37PM (#27266457)
Yeah, this is an age-old issue -- in the early 00s, my mom got a domain and used the email <first_initial>@<domain>.com. She gave up battling the deluge of spam after about a year. We looked through the logs, and saw that her next choice of handle was also getting tons of spam, too, because it was also short.
Re:Complexities of e-mail validation logic by batch12 on Monday May 24, 2021 @02:54PM (#27268300)
I do the same thing. I use [email protected]. The addresses are temporary if I want them to be and I can automatically lock the senders to a list that is either automatically learned after x days or manually curated. I've seen some 'marketing' mail get filtered but no hacks yet.
Re:Complexities of e-mail validation logic by cgriswald on Monday May 24, 2021 @04:07PM (#27269077)
I’ve got [email protected] email for my domain and I’ve never created such an account, much less given it out. Without some uniqueness in the username, I’m not sure you can tell a company sold or lost your data.
Re:Complexities of e-mail validation logic by bcrosby95 on Monday May 24, 2021 @12:45PM (#27266579)
Spamming is a numbers game. I kinda doubt enough people are using this scheme to make figuring this out worthwhile for a spammer.
Re:Complexities of e-mail validation logic by nerdponx on Monday May 24, 2021 @12:20PM (#27266231)
I've wondered about this with big companies like Facebook, Google, Amazon, etc. as well as behind-the-scenes spyware/ad firms who are all probably very interested in linking my identity across user accounts, email addresses, device fingerprints, etc. I've hoped that there aren't enough people doing it (yet) for these orgs to find it worth the effort.
Re:Complexities of e-mail validation logic by macNchz on Monday May 24, 2021 @12:59PM (#27266804)
There very much are companies doing this and selling it as a service...here's an API that you can query with a piece of contact information to retrieve all sorts of additional information, including hashes of alternate email addresses, mobile device ids, social media profiles, and plenty of other stuff: https://platform.fullcontact.com/docs/apis/enrich/person-ins...
Re:Complexities of e-mail validation logic by rootusrootus on Monday May 24, 2021 @01:39PM (#27267339)
At a certain point -- probably the moment it becomes a business unto itself -- this kind of data collection should be subject to all the same rules we've come up with for credit bureaus. It should be a legal requirement that I can get the entire profile they have built for me.
Re:Complexities of e-mail validation logic by nerdponx on Monday May 24, 2021 @03:11PM (#27268491)
I was wondering specifically if they have special cases to identify such "personal" email domains and use them for record linkage.

It seems like an obvious thing to try, but maybe not worth the effort of implementing it, given the high risk of false positives and the low % of people who actually do stuff like this (not to mention they're probably not people who click on ads anyway).

Re:Complexities of e-mail validation logic by rootusrootus on Monday May 24, 2021 @01:37PM (#27267304)
Given the sheer amount of money involved, I believe it is likely that there are players in the market who are far more capable than we give them credit for.
Re:Complexities of e-mail validation logic by licebmi__at__ on Monday May 24, 2021 @02:19PM (#27267848)
I kinda imagine that spammer go for low hanging fruit. So spammers won’t bother with defeating a catchall domain forwarding, as it’s unlikely to give them returns. Although a motivated attacker might decide to try to send interesting phishing.
Re:Complexities of e-mail validation logic by dhruvrrp on Monday May 24, 2021 @07:38PM (#27270991)
What do you use for email hosting? Ive tried to do something similar but most places have a limit for email addresses even with paid plans.
Re:Complexities of e-mail validation logic by SilverRed on Monday May 24, 2021 @09:51PM (#27271839)
Fastmail does not seem to have any limit listed. I have not tested any extreme case since I just use a wildcard.
Re:Complexities of e-mail validation logic by em-bee on Monday May 24, 2021 @12:10PM (#27266078)
well, you could turn it around and use + addresses everywhere, so that any legitimate response must be to one of your + addresses. then treat anything without + as spam.
Re:Complexities of e-mail validation logic by shard on Monday May 24, 2021 @05:41PM (#27270045)
That makes me want to use an email address of the form [email protected], just to see how websites would handle stripping out everything starting from the +.
Re:Complexities of e-mail validation logic by academia_hack on Monday May 24, 2021 @12:57PM (#27266758)
The + is also useful for knowing who sold your email address on or was responsible for a data breach. If I start getting spam to <my name>[email protected], then I know I could chase down Hulu on Twitter for an explanation.
Re:Complexities of e-mail validation logic by zzo38computer on Monday May 24, 2021 @01:13PM (#27267005)
I do a similar thing, except that the email is actually hosted at my domain rather than being forwarded, and that I have a list of email addresses that I accept and reject all others; if I receive too much spam at one address, I disable receiving at that address.

I have found this to work; I hardly receive any spam at all, and do not need any separate spam filter.

Re:Complexities of e-mail validation logic by unanswered on Monday May 24, 2021 @08:07PM (#27271202)
I've run into at least one domain that blocks their own name in your email; that was fun.
Re:Complexities of e-mail validation logic by frereubu on Monday May 24, 2021 @05:31PM (#27269965)
Didn't you find you got a deluge of spam to generic addresess like admin@, info@, offers@ and so on? I tried this, although it was probably about 15 years ago now, and reverted it because I got about the same amount of spam as genuine emails.
Re:Complexities of e-mail validation logic by progforlyfe on Monday May 24, 2021 @05:09PM (#27269738)
Although hardly anyone uses yahoo mail anymore, they actually have this feature built in. Basically email aliases.
Re:Complexities of e-mail validation logic by judge2020 on Monday May 24, 2021 @11:27AM (#27265476)
Note that you should only do this for maybe 6-18 characters, some sites will test send an email to [30-100 character random string]@example.com and see if it bounces - if it doesn't, it'll suspect that domain to be some spammer with a catch-all email inbox and block it.
Re:Complexities of e-mail validation logic by jasonjayr on Monday May 24, 2021 @11:38AM (#27265608)
That's a terrible approach, plenty of valid, legitimate non-spamming domains use catchalls of arbitrary length for all sorts of reasons.

Additionally, sending a test email like that might also get the sender placed on a black list for triggering a spam trap inadvertently.

Re:Complexities of e-mail validation logic by pmontra on Monday May 24, 2021 @11:48AM (#27265773)
That's a worrying strategy because there are many reasons for using a catchall. Example: one email per site to track companies selling personal data, then maybe bounce that single email address.

Do you know any site blocking domains with a catchall?

Re:Complexities of e-mail validation logic by LorenPechtel on Monday May 24, 2021 @12:27PM (#27266325)
Yeah, if you have a domain of your own the sensible thing is a catchall, use a different address everywhere and block the ones that spam.
Re:Complexities of e-mail validation logic by alufers on Monday May 24, 2021 @11:37AM (#27265597)
Do you know what sites do that? I have my own domain and I haven't seen anybody do that. The obvious solution is to configure your mail server to only accept usernames before the '@' that adhere to some rule which only you know. Like checking if it is a palindrome or something obscure like this.
Re:Complexities of e-mail validation logic by bbarnett on Monday May 24, 2021 @11:37AM (#27265598)
I watch multiple corp's mail logs extensively, this is not even remotely a common thing.

Worse, I know at least 5 or 6 people personally, which do catch all. It seems like a very poor method to reliably catch spammers.

Re:Complexities of e-mail validation logic by megous on Monday May 24, 2021 @09:10PM (#27271608)
Max local part size is 64 octets. So 100 chars would be out of spec.
Re:Complexities of e-mail validation logic by tyoma on Monday May 24, 2021 @11:03AM (#27265189)
The best are sites that let you sign up with a ‘+’ but not log in. Zappos used to be the most prominent example.
Re:Complexities of e-mail validation logic by PebblesRox on Monday May 24, 2021 @02:38PM (#27268072)
Reminds me of a patio11 post (which I haven't been able to track down) where he said he gets people signing up with a '+' but then forgetting to include the extra part when they log in later. His login code accepts both versions and increments a counter to track how many people were too smart for their own good.
Re:Complexities of e-mail validation logic by nybble41 on Monday May 24, 2021 @01:15PM (#27267022)
I've run across at least one banking site which accepted a password on the sign-up page which was later rejected by the login page. The validation scripts on the login page used a more limited set of permissible special characters which didn't include parentheses. Fortunately it was only a client-side check, so it was relatively simple to bypass it once using developer tools and change the password.
Re:Complexities of e-mail validation logic by marcod on Monday May 24, 2021 @03:35PM (#27268715)
American Express at one point let me set a password over 8 characters, but logging in after only worked if I provided only the first 8.
Re:Complexities of e-mail validation logic by lozaning on Monday May 24, 2021 @05:24PM (#27269901)
At one point I know they also weren't case sensitive.
Re:Complexities of e-mail validation logic by wtetzner on Monday May 24, 2021 @04:19PM (#27269225)
Why would you ever validate the characters of a password on the login page? What a weird thing to do.
Re:Complexities of e-mail validation logic by scubbo on Monday May 24, 2021 @01:09PM (#27266949)
I once had a site _silently strip_ the + from signup email. So when I submitted `[email protected]` as my email address, they started sending mail to `[email protected]`. Madness.
Re:Complexities of e-mail validation logic by not2b on Monday May 24, 2021 @03:08PM (#27268455)
This is common; spammers know the semantics of '+' for gmail and will strip it. You need to assume that it will happen.
Re:Complexities of e-mail validation logic by cgriswald on Monday May 24, 2021 @04:14PM (#27269161)
GP said the site stripped the “+” only, essentially sending his email to another address entirely. Spammers strip the “+” and whatever follows it, so the spam ends up at the same address.
Re:Complexities of e-mail validation logic by scubbo on Tuesday May 25, 2021 @05:50PM (#27283173)
If spammers are converting from `[email protected]` to `[email protected]`, they are welcome to spam it as much as they want - it won't get to me.

EDIT: moreover, a service is perfectly within their rights to _internally_ store my email as `[email protected]` if they want - but they should still accept `[email protected]` as the identifier used to login with.

Re:Complexities of e-mail validation logic by tshaddox on Monday May 24, 2021 @11:59AM (#27265915)
I’ve seen sites send emails where the unsubscribe link doesn’t work because the URL contains the email address I signed up with and that email address contains a character that their web server doesn’t play well with.
Re:Complexities of e-mail validation logic by dangoldin on Monday May 24, 2021 @11:22AM (#27265418)
Interesting. How did that work? Does that mean that they would only create the user account under the + suffix? I imagine they must have had two email fields - the canonical email for login and then a separate notification email?
Re:Complexities of e-mail validation logic by ridaj on Monday May 24, 2021 @12:54PM (#27266714)
Why do so many people responding to this seem to assume the plus sign is to fool spammers? Of course it's not useful for antispam. It's mostly meant to make it easier to trace where a (legit) email comes from, for example to set up filters. https://gmail.googleblog.com/2008/03/2-hidden-ways-to-get-mo...
Re:Complexities of e-mail validation logic by sellyme on Monday May 24, 2021 @10:50PM (#27272128)
> Of course it's not useful for antispam.

I've received spam emails to at least 70 different +addresses. It is absolutely useful for antispam.

Spammers don't care about the reputation of the company they bought or stole the data from.

Re:Complexities of e-mail validation logic by raffijacobs on Monday May 24, 2021 @11:05AM (#27265200)
Can't you use "." Anywhere in your email to use the same multiple times in Gmail?
Re:Complexities of e-mail validation logic by josephcsible on Monday May 24, 2021 @11:07AM (#27265219)
Yes, assuming the websites following this logic don't block that too, but then you have to keep track of a mapping of dots to websites yourself instead of it being obvious from what you put after the plus sign.
Re:Complexities of e-mail validation logic by alfon on Monday May 24, 2021 @11:42AM (#27265669)
Or use a password manager.
Re:Complexities of e-mail validation logic by mderazon on Monday May 24, 2021 @04:32PM (#27269352)
Spammers aside, I'm interested to know what strategy different saas companies do in regards to users creating an account with + alias - Do you let users create multiple accounts with the same email but different + alias ? Or do you recognize that it's an alias and say that the account already exists ?

Not all email providers support the + notion so you'd have to run domain lookup on some hard coded list

Re:Complexities of e-mail validation logic by megous on Monday May 24, 2021 @09:16PM (#27271655)
Why should they care though? Anyone with a catchall can create 7 billion normal looking addresses under their domain. It's not like it would prevent anything.

Also anyone with gmail address can also place dots almost anywhere into the local part, to create another unique address without using a + sign.

Re:Complexities of e-mail validation logic by mderazon on Tuesday May 25, 2021 @05:19AM (#27274683)
Because of spammers creating garbage accounts on your platform
Re:Complexities of e-mail validation logic by megous on Tuesday May 25, 2021 @08:57AM (#27276222)
Yeah, but why care about email address format, if it's not going to stop spammers anyway, and you're just risking losing legitimate customers if you mess up trying to mangle part of an address you should not be touching according to the recommendation in the standard?
Re:Complexities of e-mail validation logic by SilverRed on Monday May 24, 2021 @09:53PM (#27271849)
The email spec considers these different emails. It's not a websites job to worry about how an individual host treats them. Gmail also treats . in the user section as useless but most hosts do not.
Re:Complexities of e-mail validation logic by jjav on Monday May 24, 2021 @05:42PM (#27270052)
> This logic is why so many Web sites today won't let you use a plus sign in email addresses, which ruins a really nice Gmail feature.

Contrary to popular belief, it is not a gmail feature.

I first heard of the + as destination filtering in the very early 90s at CMU where it was broadly used. Every single email address I've had since then has support the same (and notably, apart from a test account, I've never used gmail much, so that's not including gmail).

Re:Complexities of e-mail validation logic by j_wtf_all_taken on Monday May 24, 2021 @11:19AM (#27265375)
I don't really think that's the same. Forgetting the "+" in the validation regular expression is something else than refusing to implement all kinds of extra checks to support very weird and very unused things.
Re:Complexities of e-mail validation logic by alkonaut on Monday May 24, 2021 @02:16PM (#27267808)
Sites likely prefer your canonical/standard email address over any plus version. It would be easy to trim anything after the plus too I guess and just email you at your normal address
Re:Complexities of e-mail validation logic by gumby on Monday May 24, 2021 @02:36PM (#27268054)
I configured my mail server to use _ as a sub mailbox identifier to stop creeps who block +. I assume they are doing it to make sure their precious spam shows up in my inbox.
Re:Complexities of e-mail validation logic by toxik on Monday May 24, 2021 @11:09AM (#27265246)
OTOH, it being a standardized thing, a spammer would absolutely just strip that plus part off. Better do it secretly like a catch-all.
Re:Complexities of e-mail validation logic by nybble41 on Monday May 24, 2021 @01:28PM (#27267209)
It's not really all that standardized. The use of a '+' character to indicate an alias or label is merely convention—if you run your own server you can set the separator to any character you wish, or disable the feature altogether. As far as the RFCs are concerned the '+' character is just part of the account name and there is no reason why it cannot be a mandatory part of the account name on any particular server, such that stripping off the '+' and any trailing characters results in an invalid e-mail address, or even someone else's e-mail account. For sending email or using an email address as an account identifier it's definitely incorrect to treat [email protected] and [email protected] as equivalent. The same goes for account names which differ only in capitalization or placement of periods: some servers are case-insensitive and ignore periods in account names (e.g. Google) but these are server-specific traits and compliant email senders should not assume that every server will work the same way.

The '+' alias feature is a fairly common configuration, though, so for source labels it's better to either treat all unlabeled messages as spam or else use a more opaque labeling scheme ([email protected]) which doesn't hint at an alternative untracked email address.

Re:Complexities of e-mail validation logic by stonogo on Monday May 24, 2021 @01:54PM (#27267539)
Subaddressing is standardized in RFC 5233.
Re:Complexities of e-mail validation logic by nybble41 on Monday May 24, 2021 @01:58PM (#27267594)
For the Sieve Email Filtering Language, yes. Which is not actually part of SMTP. And even in RFC 5233 the specific separator sequence is up to the server; the RFC only specifies queries for ":user", ":detail", and ":localpart" to filter on the different fields independent of the choice of separator.
Re:Complexities of e-mail validation logic by dejj on Tuesday May 25, 2021 @03:26AM (#27273910)
Can you recommend a library / tool which can extract those reliably?
Re:Complexities of e-mail validation logic by gxnxcxcx on Monday May 24, 2021 @12:51PM (#27266652)
I think that when using email aliases to identify spam sources, the crucial part is that you can filter the stripped address (as well as any unapproved alias) to be directly identified as spam and then the +alias part becomes a key to properly get into the inbox.

That whole setup for tidiness is broken the moment a desired website does not accept an alias in your address, of course.

Re:Complexities of e-mail validation logic by sellyme on Monday May 24, 2021 @10:55PM (#27272160)
> a spammer would absolutely just strip that plus part off

Why? They don't care about protecting the business interests of wherever they got that address from, and it's not like stripping the plus off will meaningfully increase the success rate.

Re:Complexities of e-mail validation logic by jimktrains2 on Monday May 24, 2021 @07:07PM (#27270751)
The plus is a standard feature of email, not a Google specific thing like ignoring dots.
Re:Complexities of e-mail validation logic by ipaddr on Monday May 24, 2021 @08:03PM (#27271169)
gmail != email. Breaking gmail features helps ensure a level playing field.
Re:Complexities of e-mail validation logic by fomine3 on Monday May 24, 2021 @10:02PM (#27271897)
It also breaks legit non-gmail address
Re:Complexities of e-mail validation logic by vorpalhex on Monday May 24, 2021 @12:14PM (#27266130)
My email address is valid and has been valid for a really long time.. but about 5% of ecommerce shops refuse to accept it.. so they don't get my money.

Don't get clever, just follow the spec.

Re:Complexities of e-mail validation logic by yupper32 on Monday May 24, 2021 @01:16PM (#27267037)
If 5% of ecommerce shops refuse to accept it, it's likely you being clever.

My email is refused by 0% of ecommerce shops... because I just have a normal email.

Don't be clever, pick a better email.

Re:Complexities of e-mail validation logic by drdaeman on Monday May 24, 2021 @02:36PM (#27268056)
What's "normal", though? "<8-10latinalphanumerics>@gmail.com?"

My email is just "me@<my-last-name>.al"[1] which is just a tiny bit "unusual" - and over the years it got refused by a couple stores because of TLD. And Albania is not Cocos Islands, they're surely not popular with spammers.

If a store believes there's only ".com" gTLD and nothing else (this had really happened to me, some galaxy-brain made a form with a hardcoded ".com" suffix; not even ".net" or ".org" were accepted, unfortunately I don't remember the site) - well, fuck that store, their loss not mine. Worst case, if I really want something they sell, I'll give them a throwaway email - which will contribute to their mail bounces after some time.

__________

[1] ".al" is a ccTLD for Albania which is not a country of my citizenship or residence. I've picked the domain name as hack - because my first name is Aleksei and my first and middle names form "A.L." initials as well. That, and because all relevant .name domains were already taken.

Re:Complexities of e-mail validation logic by yupper32 on Monday May 24, 2021 @05:06PM (#27269707)
Might sound strange but yes, me@<my-last-name>.al is being clever. You found a nice short clean email by buying a domain from Albania and setting up a me@ address. That's clever.

Think about it this way: either you can get some big brand .com email with no special username and never have an issue, or you can flail around 5% of the time and yell at the clouds.

Should everyone accept your email? Of course! I'm just saying you live in real life, and in real life people suck at building email forms. The problems you run into are on you.

Re:Complexities of e-mail validation logic by oarsinsync on Monday May 24, 2021 @05:20PM (#27269862)
> Should everyone accept your email? Of course! I'm just saying you live in real life, and in real life people suck at building email forms. The problems you run into are on you.

No, the problems they run into are caused by (at best) mediocre developers. They’re entirely to blame. We have specs and standards for a reason.

Re:Complexities of e-mail validation logic by yupper32 on Monday May 24, 2021 @05:26PM (#27269922)
I honestly don't understand what you're trying to say. What's actionable about your view? You going to call up every business that doesn't accept your email and tell them their programmers suck? Businesses like this are never going away. It's a losing battle.

Instead you can just get a big name .com email and call it a day. Live your life without trying to make some statement about email standards.

Re:Complexities of e-mail validation logic by sellyme on Monday May 24, 2021 @10:57PM (#27272171)
> You going to call up every business that doesn't accept your email and tell them their programmers suck?

No, because it's not 1993, but I absolutely do use the contact forms or bug reporter for any website that doesn't accept my email. Most of them fix it, because it's objectively a bug caused by their non-compliant code.

Re:Complexities of e-mail validation logic by oarsinsync on Tuesday May 25, 2021 @02:13AM (#27273344)
I completely agree with the pragmatic response, and not only encourage it, but do this myself too. It is absolutely the correct advice in the situation.

However. I completely disagree with the conclusion “The problems you run into are on you.”

I didn’t create the problem by having the audacity to be from a different country.

Re:Complexities of e-mail validation logic by vorpalhex on Monday May 24, 2021 @08:38PM (#27271420)
We should totally shame developers/businesses who don't accept valid emails, just as we should continue shaming those with insane password policies or insecure practices.
Re:Complexities of e-mail validation logic by dntrkv on Monday May 24, 2021 @07:49PM (#27271072)
This conversation reminds me of the 0.00001% of people that browse the internet with JS disabled and then complain about how so many sites don't work for them.
Re:Complexities of e-mail validation logic by woah on Monday May 24, 2021 @03:34PM (#27268697)
If you aren’t accepting very normal email addresses at perfectly valid TLDs, then you are a bad programmer. At least import a list of the new TLDs every ten years.
Re:Complexities of e-mail validation logic by yupper32 on Monday May 24, 2021 @05:21PM (#27269870)
Of course they're a bad programmer. But we live in real life, where bad programmers exist.

Get a big brand .com email and you'll never run into an issue.

Re:Complexities of e-mail validation logic by skeeter2020 on Monday May 24, 2021 @12:47PM (#27266602)
>> Don't get clever, just follow the spec.

I'd suggest being clever is wasting countless hours to handle your edge case. Or writing your own email validation in the first place.

Re:Complexities of e-mail validation logic by shard on Monday May 24, 2021 @05:38PM (#27270026)
> wasting countless hours

Isn't email validation a solved problem in that there are services or ready software which provide RFC-compliant validation? If some company is wasting countless hours to do something because of Not Invented Here syndrome, isn't that the same as some company deciding to write cryptography algorithms on their own and reaping what they sow?

Re:Complexities of e-mail validation logic by lisper on Monday May 24, 2021 @12:19PM (#27266209)
> about 5% of ecommerce shops refuse to accept it

That's surprising to me because there is nothing particularly weird about your email address. What exactly do they complain about?

Re:Complexities of e-mail validation logic by brlcad on Monday May 24, 2021 @12:36PM (#27266447)
I would assume because it's only 2-chars (me) and they're filtering anything <3 as invalid.
Re:Complexities of e-mail validation logic by lisper on Monday May 24, 2021 @12:55PM (#27266736)
Yeah, that's what I would guess as well. But there's a big difference between "follow the [ridiculously complicated] spec to the letter" and "don't do obviously stupid things like filter out email addresses with short names". The latter is good advice, the former not so much IMHO.
Re:Complexities of e-mail validation logic by Domenic_S on Monday May 24, 2021 @01:41PM (#27267379)
For a couple glorious years I had a 2-letter email address at a single-letter .com domain. It was rejected a surprisingly small number of times.
Re:Complexities of e-mail validation logic by isoskeles on Monday May 24, 2021 @12:58PM (#27266793)
Ah, that's a good assumption. My initial assumption was some sites have a very dumb whitelist of valid email domains. This seems more reasonable (although, also dumb).
Re:Complexities of e-mail validation logic by mixmastamyk on Monday May 24, 2021 @12:27PM (#27266317)
Quotes included or not?
Re:Complexities of e-mail validation logic by lisper on Monday May 24, 2021 @12:35PM (#27266427)
Not. Obviously, or the rejection ratio would be a lot higher than 5%.
Re:Complexities of e-mail validation logic by alkonaut on Monday May 24, 2021 @02:23PM (#27267886)
Your money is likely a minuscule part of the revenue and supporting your email would likely cost more. This was the point, that it is probably clever to choose a validation that covers 99.99% of customer emails rather than cover the whole spec.
Re:Complexities of e-mail validation logic by jchw on Monday May 24, 2021 @12:36PM (#27266444)
If you can show that "just follow the spec" ends up opening up more opportunity than it closes off, then you can convince people. However, when gmail, outlook, etc. do not allow these zany e-mail addresses, you're going to have a hella hard time convincing me of this unless you are in the 1% of spenders.
Re:Complexities of e-mail validation logic by BenjiWiebe on Monday May 24, 2021 @01:39PM (#27267335)
Do GMail et al actually prevent you from sending to and receiving from these zany addresses? Or merely prevent you from creating one @gmail.com?
Re:Complexities of e-mail validation logic by jchw on Monday May 24, 2021 @01:40PM (#27267360)
Creating one. But when you consider just how many customers are using gmail and outlook addresses, and not to mention, GSuite/fastmail/etc. addresses under custom domains, it makes more sense why rejecting @[email protected] is worth more than allowing some crazy e-mail feature that is effectively not used.
Re:Complexities of e-mail validation logic by not2b on Monday May 24, 2021 @03:11PM (#27268483)
The routing features are obsolete; they go back to the days when lots of email users weren't on the Internet directly and had to use relays. They are still in the spec, yes.
Re:Complexities of e-mail validation logic by jchw on Monday May 24, 2021 @03:27PM (#27268631)
I assume it comes from similar lineage as UUCP paths. Either way, email standards are a bit ridiculous. It needs the kind of rehaul that occurred with HTML5 of looking at what email implementations actually do and pushing them in one direction. I suspect that is not happening ever, so failing that there will probably always be things in the spec that just simply don’t work across everything anymore.
Re:Complexities of e-mail validation logic by markonen on Monday May 24, 2021 @11:55AM (#27265866)
You absolutely should check the MX records, though. It’s easy and catches tons of typos. I was floored by the difference when I implemented this as pre-check before a Stripe Checkout form.
Re:Complexities of e-mail validation logic by eli on Monday May 24, 2021 @04:33PM (#27269366)
There's also incredibly low stakes in allowing a technically-invalid email address to pass validation. Just use a very permissive pattern (e.g. contains an '@') and be done with it.

No matter what you will constantly be getting addresses that conform to the spec but cannot actually receive mail.

Re:Complexities of e-mail validation logic by scotu on Monday May 24, 2021 @11:40AM (#27265639)
I found websites not allowing perfectly valid tlds, so maybe they could be starting not using .com in their regex. (.email)
Re:Complexities of e-mail validation logic by jcranmer on Monday May 24, 2021 @11:55AM (#27265876)
The basic rule of thumb I use this: are you implementing email at the MTA level (needing to build/parse RFC 5321 commands or RFC 5322 blobs directly), or are you using email closer to a "universal internet ID" purpose (i.e., application perspective)?

If you are in the former category, then yes, follow the spec to the letter. If you're in the latter, then screw the precise guidelines of the spec and reject emails that are very unlikely to be valid: no quoted localparts, no IP address literals. In addition, go ahead and say that email is case-insensitive (more precisely, case-preserving).

The hard part is if you're writing an email client, because you're basically forced to have your hands in both pies.

Re:Complexities of e-mail validation logic by welder on Monday May 24, 2021 @11:36AM (#27265593)
Yes, in practice I've found the exact same thing. Either use an email validation service or be more restrictive than the RFC. [1] Also prompting "Did you mean [email protected]?" when the user types "[email protected]" helps a lot with human input errors. [2]

[1] https://www.mailgun.com/email-validation/

[2] https://www.npmjs.com/package/mailcheck

Re:Complexities of e-mail validation logic by ivraatiems on Monday May 24, 2021 @12:02PM (#27265968)
Except that as someone with an email at a .co domain, I get really irritated when it asks me "do you mean [mydomain].com?"

I always have to tell people, in real life, "it's .co, not .com," just in case - humans do this too.

Re:Complexities of e-mail validation logic by cygned on Monday May 24, 2021 @12:29PM (#27266349)
Worse, I had services trying to be smart correcting .co to .com
Re:Complexities of e-mail validation logic by welder on Monday May 24, 2021 @12:07PM (#27266040)
Yep, it's solving for the majority case. As long as it doesn't block signup you can just ignore it.
Re:Complexities of e-mail validation logic by throwaway09223 on Monday May 24, 2021 @01:44PM (#27267406)
How do you reconcile your concern for the cost of sending emails with your unwillingness to do super basic validation like checking an MX record?
Re:Complexities of e-mail validation logic by nawgz on Monday May 24, 2021 @02:01PM (#27267640)
From where I sit, both of those concerns sit on the same side of fence. GP argues against extensive developer time spent on validating edge-case emails, and says they do so in no small part to avoid having emails bounce etc., as doing MX or other validation to follow-up on these edge-case emails validity within your service does nothing to imply others have put in this same costly and nearly superfluous support, likely leading to more emails bouncing and accordingly degrading the trust in their business as a sender
Re:Complexities of e-mail validation logic by goto11 on Monday May 24, 2021 @02:52PM (#27268261)
But why restrict the syntax arbitrarily in the first place? It is not going to catch the common typos anyway. Most typos will just result in a wrong but still syntactically valid email address.
Re:Complexities of e-mail validation logic by harryf on Monday May 24, 2021 @02:54PM (#27268298)
I’ve always wondered if it’s possible to have a valid email address which is also an SQL injection attack, XSS or similar ?
Re:Complexities of e-mail validation logic by malinens on Tuesday May 25, 2021 @12:25AM (#27272585)
of course it can: https://security.stackexchange.com/a/106996

One of our testers found XSS with email injection (RFC compkiant validation passed) in our website.

And we are an e-mail company and should now better :D

Never trust user input!

Re:Complexities of e-mail validation logic by goto11 on Tuesday May 25, 2021 @03:06AM (#27273786)
Probably, since the local name part can be basically anything.

But the way to prevent injection attacks is not to disallow or sanitize input, it is to escape correctly when interpolating strings in other languages.

Re:Complexities of e-mail validation logic by jcelerier on Monday May 24, 2021 @12:14PM (#27266128)
> Sending emails cost money and bouncing emails affects your sender reputation.

that works as long as <RFC>fan 69™@root does not write articles for ZDNet

Re:Complexities of e-mail validation logic by 3np on Monday May 24, 2021 @11:53AM (#27265850)
How about not doing any pre-validation (save for whitespace stripping) and have a validation e-mail (which you should require anyway) take care of any typos?

With precious dev time, you can do better by doing less.

Re:Complexities of e-mail validation logic by edoceo on Monday May 24, 2021 @12:28PM (#27266344)
You risk sending a junk message tho, which affects your sender-spam score with other providers.

I just make folks email me first.

Re:Complexities of e-mail validation logic by jacobobryant on Monday May 24, 2021 @01:24PM (#27267149)
I do the validation email, works great. Just be sure to protect the sign up form with some type of bot detection (I use recaptcha, but simpler methods are fine for most sites).
Re:Complexities of e-mail validation logic by the_arun on Monday May 24, 2021 @11:42AM (#27265664)
Instead of every developer implementing validation logic, shouldn't we have validation libraries to take care of this?
Re:Complexities of e-mail validation logic by forty on Monday May 24, 2021 @12:54PM (#27266725)
100% agree. This is especially true if the address mail is going to be displayed somewhere for example, it's generally a good idea to limit email address to a sunset of what the RFC allows.

To adapt from a famous quote: "all email validation logics are wrong, but some of them are useful" ;)

Re:Complexities of e-mail validation logic by bradknowles on Saturday May 29, 2021 @08:16PM (#27329445)
As the Sr. Internet Mail Administrator for AOL in 1995, we quickly learned that the only real way to validate an e-mail address was to send mail to it. Even that wasn’t guaranteed, but anything less was doomed to unexpected failure and misery.

And this wasn’t a new lesson then. But at least we were smart enough to listen to the people who had learned that lesson before us.

It is now over 25+years later, and I’m sad to see that many people seem to be bound and determined to force themselves to re-learn that lesson the hard way.

Re:Complexities of e-mail validation logic by toomanybeersies on Monday May 24, 2021 @02:22PM (#27267882)
I also came to the same conclusion some years ago. Or more specifically, my manager brought me around after I tried arguing that it was worth the time to make sure that users could use an IPv6 address as their domain (the lack of periods after the @ would cause `user@2001:0db8:85a3:0000:0000:8a2e:0370:7334` to fail validation)

He made a very convincing argument that while an IP address is technically a valid domain, but how many legitimate users were seriously using an IP address as their email domain? (zero)

Re:Complexities of e-mail validation logic by bombcar on Monday May 24, 2021 @10:27PM (#27272019)
You’ll love this SSL cert:

https://[2606:4700:4700::1111]/

Re:Complexities of e-mail validation logic by bradknowles on Saturday May 29, 2021 @02:22AM (#27323424)
This falls into the category of the classic “Stupid shit that most programmers believe”.

Fundamentally, the problem is that if you’re trying to validate an e-mail address as being correct and you’re not sending an actual e-mail message to that address, then you’re doing it wrong.

We learned this lesson back in 1995, people.

Re:Complexities of e-mail validation logic by unoti on Monday May 24, 2021 @01:05PM (#27266898)
Totally agree with this. Trying to be perfect is a good road to paralysis and not getting things done. Software is like people: it's ok to not be perfect, especially if they're always trying hard to be better and doing good things for society.
Re:Complexities of e-mail validation logic by megous on Monday May 24, 2021 @10:00PM (#27271890)
Yes, you should reject it, because the address is invalid. You can't have unquoted <> in the local part. You can't have spaces there either.

Your other reasons for breaking interop between systems/languages are just whimsical and invalid. :)

Re:Complexities of e-mail validation logic by novok on Monday May 24, 2021 @04:54PM (#27269583)
I've run into some places where a subdomain email is not ok, which has been pretty annoying. All email validators should be able to at least take [email protected]
Re:Complexities of e-mail validation logic by macksd on Monday May 24, 2021 @04:57PM (#27269612)
Especially when using a country TLD, suffixes like .co.za are appended to the name of the actual ISP or email provider.