News for hackers. Stuff that matters.
Re:Dotless Domains by 90s_dev on Saturday May 10, 2025 @10:32PM (#43950808)
Ahh, I actually ran into this question, at least indirectly, about a month ago!

I was writing an email validator for my project which I'm so excited to announce soon. And my research (some stackoverflow answers) suggested that, yeah, you can have "a@b" as a valid email, as long as there's a one-letter TLD that can have MX records.

Which it seems there can be!

So my email validator is essentially just /^.{1,}@.{1,}$/ ... yay.

Re:Dotless Domains by gerdesj on Saturday May 10, 2025 @10:45PM (#43950880)
I don't know if it is still required but hostnames used to require a minimum of two chars and the first shalt not be an integer. Given that DNS does not put a proper boundary on host/domain, that might extend to your top level ... thingie.

However, there is absolutely no technical reason that I can think of that precludes u@x. In the end DNS query -> DNS answer. Given that say, PowerDNS has LUA built in, I can make it respond with "my little pony's stable is in {random_country}" - to A record requests, which might make the requester a little queasy!

Bugger standards, they are so 1990s!

Re:Dotless Domains by esperent on Saturday May 10, 2025 @10:54PM (#43950930)
the first shalt not be an integer

I recently came across the 3.ie domain so I guess that's more of a guideline than rule.

Re:Dotless Domains by AStonesThrow on Sunday May 11, 2025 @12:38AM (#43951423)
I believe that the rule has been deprecated due to better parsing.

In the mid-90s, 3M was a customer of the ISP I worked for. Unable to procure the domain name “3m.com” they settled for the alternate “mmm.com”: mildly hilarious considering their lines of business.

Re:Dotless Domains by leslielurker on Monday May 12, 2025 @04:27AM (#43960773)
Funny to see mmm.com still works, but it loads up the 3M site without its stylesheet and shows a 404 page. I guess the redirect has been forgotten about at some point.
Re:Dotless Domains by qaisjp on Saturday May 10, 2025 @10:39PM (#43950850)
out of curiosity, why are you trying to validate emails?
Re:Dotless Domains by 90s_dev on Saturday May 10, 2025 @10:42PM (#43950871)
Just a base level regex before sending emails, to avoid some errors sending to non-email addresses and logging otherwise unnecessary errors.
Re:Dotless Domains by esperent on Saturday May 10, 2025 @11:03PM (#43950988)
The best you can hope to do is reduce a small class out of possible errors. But you'll never get a test that can prevent errors like [email protected], [email protected], [email protected] etc. So is it really worth doing any checks at all?

I have a .blue email address and it's amazing how many sites still won't accept it. I keep a spare Gmail account for these.

Re:Dotless Domains by arp242 on Saturday May 10, 2025 @11:28PM (#43951116)
> So is it really worth doing any checks at all?

People accidentally typing their name in the email field, stuff like that. I've done that.

The problems with your .blue is obviously completely unrelated to the "email.contains('@')" check the poster is doing.

Re:Dotless Domains by 90s_dev on Saturday May 10, 2025 @11:37PM (#43951149)
I resent being called a poster! I am not flat, nothing was ever printed on me. I am a human being, you.. you... you piece of sheet!
Re:Dotless Domains by 90s_dev on Saturday May 10, 2025 @11:57PM (#43951233)
The downvotes are a sign that I did not notice that my reply to the poster was not composed. I got the memo, and will take note from now on, mark my words!
Re:Dotless Domains by qingcharles on Saturday May 10, 2025 @11:22PM (#43951079)
.blue is 11 years old and still has issues. Same with several of the gtlds I have. I had an argument with a major backend email provider recently who refused to open an account for me as my gtld wasn't "valid." (they backed down eventually and fixed their code)

I keep a Gmail for the same reason.

I tried to add a .wiki link to a Reddit profile recently and their filters also say that domain is invalid.

Re:Dotless Domains by jjani on Sunday May 11, 2025 @12:10AM (#43951297)
> I tried to add a .wiki link to a Reddit profile recently and their filters also say that domain is invalid.

That's absurd, there's a .wiki that's almost definitely in the top 20 most visited websites in Korea, if not higher.

Re:Dotless Domains by HeliumHydride on Sunday May 11, 2025 @12:13AM (#43951304)
There's also minecraft.wiki.
Re:Dotless Domains by 90s_dev on Saturday May 10, 2025 @11:16PM (#43951054)
In other words, /^.+?@.+$/ is a user-friendly reminder that you forgot the @ sign or something. That's all.
Re:Dotless Domains by thedufer on Sunday May 11, 2025 @01:29PM (#43955335)
> But you'll never get a test that can prevent errors like [email protected], [email protected], [email protected] etc. So is it really worth doing any checks at all?

You can do quite well at this, if you're willing to not restrict yourself to regexes and commit to some amount of hackery. One system I worked on used a simple regex (just what is described here IIRC - assert the existence of an @ sign), plus did an MX check on the domain, plus warned (not errored) if the domain was within 1 or 2 Levenshtein distance of any of a list of most common email domains (yahoo, gmail, etc). Statistically it seems like we saved people a lot of grief with this simple filtering.

Re:Dotless Domains by bch on Saturday May 10, 2025 @10:59PM (#43950963)
Does this block things like the unconventional Google-filing trick of:

  [email protected]
which gives me the “90sdev” tag for my emails, which still go squarely into my “[email protected]” address? I don’t know what the best route is, but I’ve certainly run into bad validators that block things that otherwise work, and that’s annoying. It seems to me the best thing might be to have a user twice input their address, then have the next step/confirmation done via email.
Re:Dotless Domains by esperent on Saturday May 10, 2025 @11:05PM (#43950998)
> bad validators

Possibly these validators are working exactly as intended and don't want you to know which service sold your email to spammers.

Then again maybe spammers are smart enough to strip of the + from email lists they purchase.

Re:Dotless Domains by kevin_thibedeau on Sunday May 11, 2025 @02:35AM (#43951866)
The latter was motivation to get my own domain so I can have unlimited unique addresses with a wildcard entry.
Re:Dotless Domains by genewitch on Monday May 12, 2025 @03:07AM (#43960355)
I never get spam that makes it through the default filter, so I am unsure if this works, but I do get zero spam in general since switching off gmail. I like giving silly businesses that ask for my email their business name @ my domain.

Most of the time they're too disinterested to notice. Oil change places always notice for some reason.

I'll look through my spam foldsr tomorrow and see who's been naughty.

Re:Dotless Domains by 90s_dev on Saturday May 10, 2025 @11:03PM (#43950991)
I don't do blocking or differentiating. Emails are literal, for better or worse.
Re:Dotless Domains by rendx on Sunday May 11, 2025 @05:09AM (#43952475)
> unconventional Google-filing trick

Documented as "subadressing" in RFC 5233, and the default for both sendmail and postfix, amongst others. As such, often 'accidentially' supported by many mail providers even when undocumented. Google didn't introduce them, nor are they 'unconventional'.

https://www.rfc-editor.org/rfc/rfc5233

Re:Dotless Domains by bch on Sunday May 11, 2025 @02:56PM (#43956091)
TIL
Re:Dotless Domains by qingcharles on Saturday May 10, 2025 @11:19PM (#43951066)
Does your regex support emoji usernames and domains? (both of which are in use, e.g. https://mailoji.com/)
Re:Dotless Domains by 90s_dev on Saturday May 10, 2025 @11:24PM (#43951093)
My project doesn't even support emojis or unicode. In context, it's not an issue.
Re:Dotless Domains by kevin_thibedeau on Sunday May 11, 2025 @02:50AM (#43951926)
Both parts are limited to 7-bit ASCII or a subset thereof. Emojis have to be in punycode. You could theoretically use UTF-7 for the local-part but nothing supports it in practice.
Re:Dotless Domains by qingcharles on Monday May 12, 2025 @01:31PM (#43965475)
That's the spec, for sure! The domains are converted to punycode, but the usernames? I have no idea what happens to them. My tests showed some providers delivered them, some didn't. I'm sure there are a bunch of people out there using accented characters and CJK etc in their usernames and wondering why it's not going so well...
Re:Dotless Domains by bigstrat2003 on Sunday May 11, 2025 @03:41AM (#43952119)
That is officially the most cursed thing I've read all week. People really do love to do bizarre things just for the hell of it sometimes.
Re:Dotless Domains by 38 on Saturday May 10, 2025 @11:02PM (#43950982)
Re:Dotless Domains by 90s_dev on Sunday May 11, 2025 @11:35AM (#43954508)
My site doesn't use HTML so that's not gonna help here.
Re:Dotless Domains by andrewmcwatters on Saturday May 10, 2025 @10:58PM (#43950955)
You should know there is a standard regular expression for validating email addresses mentioned in an RFC.
Re:Dotless Domains by 90s_dev on Saturday May 10, 2025 @10:59PM (#43950962)
I'm sure there is. And I'm sure many email servers deviate from it.
Re:Dotless Domains by Xss3 on Sunday May 11, 2025 @11:08AM (#43954328)
The real validation is the link in the confirmation email.

Tbh though ideally you would use the most restrictive validation that exists in the mail server. If mail server accepts '@tld' you do too.

Re:Dotless Domains by jph00 on Sunday May 11, 2025 @03:48AM (#43952148)
Last time I checked the RFC the bit before the '@' can actually be empty. And the root zone is just '.', but we generally can leave off the trailing dot in domain names. So I believe '@' on its own is a valid email address.

Many years ago I managed to get a cctld owner to point their tld MX records at my smtp server, modified postfix to allow empty usernames (even although the RFC allows them, postfix didn't), and successfully had someone send me email to '@tld', in order to win a bet. :) (And it was a 2-letter tld.)

Re:Dotless Domains by 90s_dev on Sunday May 11, 2025 @11:34AM (#43954503)
> So I believe '@' on its own is a valid email address.

Then the owner of "@" cannot use my site. I'm fine with that.

Re:Dotless Domains by Dylan16807 on Sunday May 11, 2025 @07:22PM (#43958140)
{1,} is just an awkward way of saying + isn't it?
Re:Dotless Domains by 1718627440 on Monday May 12, 2025 @01:41PM (#43965588)
But that would fail on the valid email "alice".