package emile
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=da1e2891c1e18937d7f742e49f34780c7c36d99fa313addb1a4a45a783cf6d1a
sha512=1e259da12932bb220df6d6d8aad3abb54a82bf74210938719f31f515442abad590fd774aa1aa60ee8cbfdc2783e3ec72431d543bef5cb2d5ef292b41de92fa5c
Description
Parser of email address according RFC 822
Published: 11 Dec 2019
README
Emile (& Images)
Emile is a library to parse an e-mail address in OCaml. This project is an extraction of mrmime.
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) without folding-whitespace.
Folding whitespace
According RFC 822, an e-mail address into an e-mail can be splitted by a folding-whitespace. However, this kind of form is not an usual case where user mostly wants to parse input from a form (for example). At the end, emile
is not able to parse this kind of input:
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)"
However, a pre-process (like unstrctrd) can fold input and give you an usual output. emile
can not be used into an e-mail context without this kind of pre-process.
Domain
Then, for domain part (explained on RFC 5321 - SMTP protocol), we handle this kind of domain (IPv4 and IPv6 domain) with ipaddr:
first.last@[12.34.56.78]
first.last@[IPv6:1111:2222:3333::4444:12.34.56.78]
It's possible to notify multiple domains for one local-part like this:
<@a.com,b.com:john@doe.com>
It's a valid form according RFC 882.
Comments
Even if we don't handle the folding-whitespace, we are able to discard comments.
a(a(b(c)d(e(f))g)h(i)j)@iana.org
Advise
If you think it's easy to parse an e-mail address, you should look tests.