FOSDEM
Because strict syntax rules break on valid edge cases and evolving domains, software should only check for an at sign and verify delivery through an outbound confirmation link.
AI-assisted summary of So you think you can validate email addresses A journey down RFC5321 — original source. Check the original for full context.
Source published:
Key ideas
- Stavros Korokithakis argues that attempting to validate email addresses using complex regular expressions is fundamentally broken because human intuition consistently conflicts with RFC 5321 specifications. (7:22)
- Under email RFCs, seemingly bizarre patterns like quoted spaces, embedded comments in parentheses, and unadorned decimal IPv4 addresses are standards-compliant, while consecutive dots or unquoted leading/trailing dots remain invalid. (1:46)
- The only reliable, future-proof method to validate an email address is verifying the presence of an '@' sign and dispatching a confirmation link for the user to click. (7:22)
- Overly strict form validation frequently locks out legitimate users with valid plus-addressing, long top-level domains, or internationalized domain names (IDNs). (8:04)
Detailed notes
## Background This lightning talk by Stavros Korokithakis was published on YouTube by FOSDEM on February 10, 2018. Recorded live at FOSDEM 2018 in room K.1.105 (La Fontaine), the session explores the intricacies and RFC standards behind validating email addresses.
## TL;DR Stavros Korokithakis leads a fast-paced audience quiz testing bizarre edge cases permitted under RFC 5321, from comments inside parentheses to quoted spaces and unadorned decimal IPv4 hostnames. He demonstrates that human intuition almost always fails when trying to parse standards-compliant email formats, rendering complex regex validation routines fragile and counterproductive. Ultimately, he argues that developers should stop over-engineering syntax checks altogether: the only pragmatic, future-proof approach is to verify the presence of an '@' sign and confirm the address by sending a verification link.
## Atmosphere & style The presentation is energetic, irreverent, and packed with dry wit, opening with deadpan humor about the utility of the talk and an immediate breakdown of the slide remote. The atmosphere feels like an interactive comedy set for software engineers, driven by lively audience participation where attendees shout out conflicting answers only to be baffled by obscure RFC specifications. Korokithakis's playful exasperation with overly strict web forms creates an engaging, communal camaraderie that leaves the audience laughing while embracing a refreshingly simple engineering lesson.
## Bulletin - [07:22](https://www.youtube.com/watch?v=xxX81WmXjPg&t=442s) Stavros Korokithakis argues that attempting to validate email addresses using complex regular expressions is fundamentally broken because human intuition consistently conflicts with RFC 5321 specifications. - [01:46](https://www.youtube.com/watch?v=xxX81WmXjPg&t=106s) Under email RFCs, seemingly bizarre patterns like quoted spaces, embedded comments in parentheses, and unadorned decimal IPv4 addresses are standards-compliant, while consecutive dots or unquoted leading/trailing dots remain invalid. - [07:22](https://www.youtube.com/watch?v=xxX81WmXjPg&t=442s) The only reliable, future-proof method to validate an email address is verifying the presence of an '@' sign and dispatching a confirmation link for the user to click. - [08:04](https://www.youtube.com/watch?v=xxX81WmXjPg&t=484s) Overly strict form validation frequently locks out legitimate users with valid plus-addressing, long top-level domains, or internationalized domain names (IDNs).
## Key takeaways - [00:06](https://www.youtube.com/watch?v=xxX81WmXjPg&t=6s) Most developers have written email parsing and validation logic, yet almost universally misunderstand the full complexity of email RFC specifications. - [01:46](https://www.youtube.com/watch?v=xxX81WmXjPg&t=106s) Leading dots, trailing dots, and consecutive dots in an unquoted local part violate standard SMTP specifications and are invalid. - [01:46](https://www.youtube.com/watch?v=xxX81WmXjPg&t=106s) Uncommon punctuation characters such as asterisks in the local part are fully standards-compliant. - [01:46](https://www.youtube.com/watch?v=xxX81WmXjPg&t=106s) Parentheses in certain locations represent RFC-compliant comments that mail servers deliberately ignore. - [01:46](https://www.youtube.com/watch?v=xxX81WmXjPg&t=106s) Quoted strings allow spaces and '@' symbols inside the local part, and a quoted space can even serve as the entire local part. - [01:46](https://www.youtube.com/watch?v=xxX81WmXjPg&t=106s) Bracketed IPv6 hostnames and unadorned decimal representations of IPv4 addresses are completely valid destination hosts under the specifications. - [07:22](https://www.youtube.com/watch?v=xxX81WmXjPg&t=442s) Real-world implementations frequently diverge from RFC theory, such as RFC 5321 mandating case sensitivity in the local part while major providers treat it as case-insensitive. - [07:22](https://www.youtube.com/watch?v=xxX81WmXjPg&t=442s) Complex regular expressions for email validation create false negatives that block legitimate users and should be discarded. - [07:22](https://www.youtube.com/watch?v=xxX81WmXjPg&t=442s) The optimal validation flow requires only two steps: verify that the string contains an '@' sign, and send a message requiring user confirmation. - [08:04](https://www.youtube.com/watch?v=xxX81WmXjPg&t=484s) Round-trip email confirmation provides superior security compared to regex validation by verifying true inbox access without producing false positives. - [08:04](https://www.youtube.com/watch?v=xxX81WmXjPg&t=484s) Websites commonly reject valid plus-addressed emails ('+') because engineers test against narrow, conventional address samples without reading RFC standards. - [08:04](https://www.youtube.com/watch?v=xxX81WmXjPg&t=484s) Enforcing rigid length or formatting assumptions against domain names frequently breaks support for valid multi-letter TLDs and intranet hosts. - [13:24](https://www.youtube.com/watch?v=xxX81WmXjPg&t=804s) Attempting to enforce strict negative rules on the local-part adds unnecessary maintenance overhead and risks breaking when internet standards evolve. - [14:43](https://www.youtube.com/watch?v=xxX81WmXjPg&t=883s) Internationalized domain names (IDNs) and Cyrillic characters can visually mimic ASCII punctuation while resolving as fully valid domains.
## Detailed walkthrough ### [00:06](https://www.youtube.com/watch?v=xxX81WmXjPg&t=6s) Introducing “Electronic Mail” and Audience Calibration
Stavros Korokithakis begins his lightning talk at FOSDEM 2018 with tongue-in-cheek humor, declaring that while his last name remains unpronounceable to the room, he has arrived to discuss the single most important topic of the entire conference. Looking out at the packed audience in room K.1.105, he deadpans, “I'm afraid you have grossly overestimated how useful this talk is going to be but that's fine.” He mock-introduces a supposed cutting-edge technology named “electronic mail,” explaining to the crowd that it lets people instantly send letters to pen pals all across the world over the internet.
He tests the room by asking for a show of hands: how many people have an account with services like Hotmail or AOL, how many have sent or received an email, how many have written software that uses email, and finally, how many have written software tasked with parsing and validating an email address. A significant number of hands go up for parsing. Stavros remarks that every single one of those developers will need this talk. After his remote clicker immediately refuses to work—prompting the joke that while electronic mail works, presentation remotes do not—he proceeds to flip slides manually and invites the entire room to participate in a rapid-fire quiz by shouting whether each displayed address is valid or invalid.
[01:46](https://www.youtube.com/watch?v=xxX81WmXjPg&t=106s) The Rapid-Fire RFC 5321 Validation Quiz
Stavros walks the audience through slide after slide of email addresses, exposing how deeply human intuition conflicts with RFC specifications. Basic formats pass easily, including addresses containing a plus sign or a single dot. However, edge cases swiftly trip up the audience:
- **Leading and trailing dots**: Having a dot at the beginning or end of the local part renders an address invalid. Stavros quips that anyone shouting valid needs tutoring classes. - **Consecutive dots**: Two dots in a row (e.g., `..`) are completely invalid according to the RFCs. - **Special characters and symbols**: An asterisk or other uncommon punctuation characters in the local part are fully standards-compliant and valid. - **Parentheses**: Parentheses inside an unquoted local part make an address invalid. - **RFC comments**: When parentheses enclose text in certain locations, they denote RFC-compliant comments. These comments are standards-compliant, valid, and completely ignored by mail servers. The audience murmurs in disbelief, prompting Stavros to marvel along with them: “Who wrote this stuff?” - **Double `@` signs without quotes**: Invalid under standard SMTP specifications. When an audience member asks whether this is an SMTP-level rule or user-facing mail client behavior, Stavros clarifies that this is directly from the RFC specifications at the SMTP level. - **Quoted strings**: An `@` sign or a space enclosed in double quotes is completely valid. A space can even serve as the entirety of the local part if quoted. - **Quoting mechanics**: Multiple quoted segments must be separated by dots; adjacent unseparated quotes are invalid. However, if backslash escaping is used inside properly dot-separated quotes, the address is valid. Stavros promises: “This is if you send email to this I will reply to you I will literally do it.” - **Escaping spaces without quotes**: Attempting to escape a space with a backslash without wrapping it in quotation marks remains invalid. - **Host formats**: Bracketed IPv6 hostnames are valid. Single-label top-level domains (TLDs) without an additional domain name can also be valid if the TLD resolves or accepts delivery. Unicode characters in addresses are standard-compliant. - **Decimal IPv4 addresses**: An address ending in a raw numeric string like an unadorned decimal representation of an IPv4 address is fully valid. Those who guessed valid thinking it was an IPv6 address were “correct for the wrong reasons.”
[07:22](https://www.youtube.com/watch?v=xxX81WmXjPg&t=442s) The One True Validation Rule
Following the quiz, Stavros explains that trying to validate email addresses using complex regular expressions or strict syntax trees is fundamentally misguided. Real-world implementations diverge from RFC theory anyway; for example, RFC 5321 specifies that the local part should be treated as case-sensitive, yet virtually no modern mail provider enforces case sensitivity.
```mermaid flowchart TD accTitle: Email Validation Flow accDescr: The practical email validation process proposed by Stavros Korokithakis.
subgraph InputCheck["Form Submission"] A["User submits email address"] --> B{"Contains '@' sign?"} end
subgraph Verification["Verification Phase"] B -- "No" --> C["Reject input immediately"] B -- "Yes" --> D["Send email with verification link"] D --> E{"User clicks confirmation link?"} E -- "Yes" --> F["Address is valid"] E -- "No / Bounces" --> G["Address is invalid"] end ```
Because true validity depends entirely on delivery, mail exchangers, and human inbox ownership, Stavros presents the only rule developers actually need: “How do we validate an email address? We don't, we just check if there's an at sign in there and if there is one we say okay you know passes the first check, you send an email to it and then you wait for the user to click the link or whatever.” He passionately warns web developers against blocking unusual addresses: “So if I see another signup form that says that my address is not valid I'm gonna hunt you down whoever it is and I'm gonna show you the presentation again.”
[08:04](https://www.youtube.com/watch?v=xxX81WmXjPg&t=484s) Q&A: Libraries, Plus Signs, TLDs, and Edge Cases
Stavros opens the floor to audience questions, addressing edge cases, historical quirks, and developer resistance:
- **Emojis and Standards Evolution**: When asked about emojis, Stavros jokes that adding them would be cheating, though it might be a fun idea. When asked if the standards are still shifting, he confirms that while specifications continue to develop over time, keeping the rule dead simple guarantees future compatibility. - **Validation Libraries**: Asked which software library developers should use, Stavros deadpans that every language already includes the ultimate library: checking `if '@' in string`. - **System Complexity**: An attendee asks whether email validation truly needs to be so complex. Stavros responds that sending messages across the globe requires accepting concessions; verifying delivery via an outgoing link is genuinely the simplest and most foolproof method available. - **Why Systems Reject Plus Signs**: An audience member asks why so many production websites reject addresses containing plus signs (`+`) despite widespread support by major providers. Stavros attributes this to developer ignorance: engineers test against ten conventional addresses that all look the same, assume anything outside that narrow window is erroneous, and never bother to read the standard. - **Long TLD Difficulties**: A member of the audience laments owning a four-letter top-level domain that web forms constantly reject. Stavros sympathizes, joking that anyone with a five-letter TLD is completely doomed and should just give up and get a Gmail address instead. - **Security Implications**: Asked whether accepting any string with an `@` sign introduces security vulnerabilities, Stavros counters that it is actually the most secure approach possible because it requires zero assumptions, avoids regex pitfalls, and produces zero false positives or false negatives by requiring actual round-trip verification: “No actually my rule is the most secure of all because you will actually send an email and the user will have to reply back and make sure that they received the email before you can consider them valid.” - **Intranet and Local Hostnames**: An attendee asks whether addresses on private intranets or non-public domains are valid. Stavros confirms that as long as the sending host can resolve the destination machine, the address is valid, reinforcing why a simple `@` check remains the only universal standard.
[13:24](https://www.youtube.com/watch?v=xxX81WmXjPg&t=804s) Validating Local-Parts vs. Checking for the At Sign
An audience member opens the Q&A session by pointing out that while finding universal rules in email specifications is notoriously difficult, there still appear to be some concrete constraints on the local-part. The attendee asks whether it is simply a waste of time to validate those extra local-part rules, or if developers should just stick to the simplest possible heuristic—checking whether there is an `@` sign—given how flexible standards and server configurations can be. Stavros Korokithakis acknowledges that this is a valid dilemma, explaining that developers certainly can filter out patterns if they are absolutely certain they are invalid to prevent completely unreachable addresses from hitting their servers. However, he cautions that trying to enforce strict negative rules usually backfires due to the rapid evolution of Internet specifications and domain registries. Stavros Korokithakis summarizes his practical philosophy: “I think them yeah the most general way to do it is just check for the add sign because you never know what kind of crazy new domains there will be and things like that so just send the email and be done with it.”
The floor then shifts to another audience member asking about domain routing, host movements, and whether checking without an `@` sign makes any sense at all. Stavros agrees that hosts move and infrastructure changes unexpectedly over time. Joking with the crowd about why developers overcomplicate the problem in the first place, he laughs, “I don't know some people just calm presentations and spread misinformation,” teasing the industry-wide tendency of tech talks and blog posts to invent complex, broken regular expressions rather than sticking to sending a verification email.
- Developers can write negative checks for known invalid patterns only if they are entirely certain the target address can never be reached, but doing so adds maintenance overhead. - Because new top-level domains, internationalized domain names, and edge-case hosting setups are constantly introduced, checking for an `@` symbol and dispatching a confirmation message remains the only robust validation strategy.
```mermaid flowchart TD accTitle: Email Validation Strategy accDescr: Flowchart illustrating the recommended strategy of checking for an at sign and sending a verification email versus over-validating syntax.
subgraph InputCheck["Minimal Client/Server Validation"] A["User submits email address"] --> B{"Contains '@' sign?"} end
subgraph Verification["Delivery & Resolution"] B -- "No" --> C["Reject address immediately"] B -- "Yes" --> D["Send verification message via SMTP"] D --> E{"User clicks link / confirms receipt?"} E -- "Yes" --> F["Address is valid & verified"] E -- "No" --> G["Address unconfirmed / unreachable"] end ```
[14:43](https://www.youtube.com/watch?v=xxX81WmXjPg&t=883s) Pathological Cases, Unicode Domains, and the Single Rule
The Q&A takes a humorous turn when an audience member poses an extreme edge case: what happens if the input contains only a single quoted `@` symbol as part of a quoted local-part without a standard domain separator? Stavros Korokithakis dismisses anyone intentionally trying to submit such an address: “then you don't deserve to be using the Internet and computers so yeah you're fine you deserve whatever you get a next question”
Another attendee asks whether it is legally permissible under the specifications to have punctuation, such as an exclamation mark, immediately following the `@` symbol in the remote/domain part. Stavros pauses to consider whether remote parts allow such syntax, admitting that while it seems unlikely at first glance, the rapid expansion of internationalized domain names (IDNs) means that unexpected characters or Cyrillic symbols might visually resemble quotation marks or punctuation while resolving as completely valid Unicode domains. He remarks that their own registration forms had historically rejected valid inputs before being updated just two days prior to accommodate real-world variability.
Seeing no further hands, Stavros closes the talk by rallying the room around a single, pragmatic takeaway. Stavros Korokithakis declares: “it looks like everybody is happy with one simple rule great check for a bloody @ sign this is my this is my invalid email address and this is my my website you can see stuff there and if you want I'll be around”
- Internationalized domain names mean that visual characters resembling ASCII punctuation marks could actually be valid Unicode domain components. - The ultimate conclusion of the journey through RFC 5321 is to avoid brittle, multi-line regular expressions entirely and rely strictly on checking for a single `@` sign combined with outbound email delivery.
## Mentioned Stavros Korokithakis, FOSDEM, RFC 5321, SMTP, Hotmail, AOL, Gmail, IPv4, IPv6
## Video description by Stavros Korokithakis
At: FOSDEM 2018 Room: K.1.105 (La Fontaine) Scheduled start: 2018-02-04 16:30:00+01
[Source](https://www.youtube.com/watch?v=xxX81WmXjPg)