I’m happy to announce the second version of Emile. Emile is a little library which depends on
uutf, and aims to decode e-mail adresses. We could believe it’s easy to parse e-mail, but, as I said to my last conference at ICFP 2017, it’s not the case.
So, I decided to extract from Mr. Mime the e-mail address parser and release it to let users recognize and understand e-mail addresses in OCaml.
Thus we provide some functions to recognize some kinds of e-mail:
address_of_string: could be the most used function, it expects an e-mail address as you expect
of_string: recognizes an e-mail address which could be bound with a name
List.of_string: recognizes a (optionally named) list of e-mail address set
Obviously, all of these functions handle (nested) comments, folding whitespace, and unicode (using
uutf). About the domains of the parsed e-mail adresses, we follow explanation provided by RFC5321 so we handle IPv4 and IPv6 domains (using
ipaddr). We also nicely support old e-mail adresses (e.g. multiple domains)
As you can see, this library is very young and we need to improve API further. It was designed to be used in Mr. MIME which is not the better use-case to know what people really need, so PR are welcome!
PS: this library was propulsed by the #MirageOS hackathon in Marrakech!