package emile
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=58698e8ff6797090a9ee472e3eea216e81d69910aba49c1f06f6ed1fd70fee76
sha512=407c7465c5ade34fb30668d91ad8ee0a0b6554f8b7b763378f369cd27b056b76d63b9c41fcae4fed651586bdf021ab5b15d3e8c0e432647cfb8c3055933294b6
Description
Parser of email address according RFC 822
Published: 25 Jul 2019
README
Emile (& Images)
Emile is a library to parse an e-mail address in OCaml. This project is an extraction of MrMime - but we use Angstrom instead of an internal decoder.
This implementation follow some RFCs:
We handle UTF-8 (RFC 6532), domain defined on the SMTP protocol (RFC 5321), and general e-mail address purpose (RFC 822, RFC 2822, RFC 5322) including folding-whitespace.
The last means we can parse something like:
A Group(Some people)
:Chris Jones <c@(Chris's host.)public.example>,
joe@example.org,
John <jdoe@one.test> (my dear friend); (the end of the group)"
For a general purpose, it's not needed and is close e-mail purpose.
Then, for domain part (explained on RFC 5321 - SMTP protocol), we handle this kind of domain:
first.last@[12.34.56.78]
first.last@[IPv6:1111:2222:3333::4444:12.34.56.78]
The parser of IPv*
is done by Ipaddr. As a old specification, we handle multiple-domains like:
<@a.com,b.com:john@doe.com>
Obviously, we handle (nested) comments:
a(a(b(c)d(e(f))g)h(i)j)@iana.org
All parsers are binded with a comment which explain where you can find the ABNF description and some notes about implementation. All was check by hands.
Advise
If you think it's easy to parse an e-mail address, you should look tests.