- Notifications
You must be signed in to change notification settings - Fork2
mirage/emile
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Emile (&Images)
Emile is a library to parse an e-mail address in OCaml. This project is anextraction ofmrmime.
This implementation follow some RFCs:
We handle UTF-8 (RFC 6532), domaindefined on the SMTP protocol (RFC 5321),and general e-mail address purpose (RFC 822, RFC 2822, RFC 5322)withoutfolding-whitespace.
According RFC 822, an e-mail address into an e-mail can be splitted by afolding-whitespace. However, this kind of form is not an usual case where usermostly wants to parse input from a form (for example). At the end,emile
isnot 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 (likeunstrctrd) canfold input and giveyou an usual output.emile
can not be used into an e-mail context without thiskind of pre-process.
Then, for domain part (explained on RFC 5321 - SMTP protocol), we handle thiskind of domain (IPv4 and IPv6 domain) withipaddr:
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 accordingRFC 882.
Even if we don't handle thefolding-whitespace, we are able to discardcomments.
a(a(b(c)d(e(f))g)h(i)j)@iana.org
If you think it's easy to parse an e-mail address, you should looktests.