# htmlmail
Fast, readable, correct. Choose three.
Validates email addresses according to the [WHATWG HTML specification](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address).
It also enforces some practical size limits [SMTP imposes](https://tools.ietf.org/html/rfc5321#section-4.5.3.1) (because what good is an email you can't address?).
## Why another validator? Regexes are so easy!
Good question! This started off as an experiment. I wanted to implement a simple parser using `winnow` that is readable and correct.
Performance wasn't even a consideration when I started out. It just happened. A happy little accident.
I then started writing out some basic benchmarks and noticed that we are faster than `fast_chemail` in pretty much every bench.
At least on my machine.
So I thought "hey, this is worth publishing. It's fast, readable, and correct. And really small so people can just audit it themselves!".
## Features
- Readable: The internals are all written from composable components using `winnow`. No unreadable regexes or handrolled parsers.
- Fast: In our benchmarks we outperform `fast_chemail`
- Correct: We adapted the test suite of `fast_chemail` and added a few more weird cases to ensure correctness.
**Note**: The test suite isn't ported 1:1 since `fast_chemail` actually rejects some emails that are actually allowed by the WHATWG standard.
We also run property tests against the official regex published by the WHATWG. This should ensure additional correctness.
## License
This code is licensed under the MIT or Apache-2.0 license, at your choice.