4 ms·
If anyone is interested in general MIME validation, not specifically email addresses, I wrote @ronomon/mime: https://github.com/ronomon/mime https://github.com
by jorangreef 9y ago
If anyone is interested in general MIME validation, not specifically email addresses, I wrote @ronomon/mime:
https://github.com/ronomon/mime https://github.com/ronomon/mime
The source code has comments from the various RFCs inline. It's not just a question of reading and knowing the RFCs but also of interpreting them and balancing them.
The decoder will throw detailed exceptions which are designed to pinpoint where the message went wrong, and which RFCs were broken by the message.
It also does just-in-time decoding, and decodes only the properties you access. This is much more efficient if you only need a header or two to reject spam quickly as part of a front line defense.
Above all, most of the methods are extensively fuzz-tested against independent reference implementations.