blob: db6140a8238bebcdd8c1451a15036885829f841d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
An [RFC 2822] parser.
[RFC 2822]: https://tools.ietf.org/html/rfc2822
Currently, this crate only recognizes the [RFC 2822] [name-addr] and
[addr-spec] productions, i.e., things of the form:
[name-addr]: https://tools.ietf.org/html/rfc2822#section-3.4
[addr-spec]: https://tools.ietf.org/html/rfc2822#section-3.4.1
```
Name (Comment) <email@example.org>
```
and
```
email@example.org
```
Although the above appear simple to parse, [RFC 2822]'s whitespace and
comment rules are rather complex. This crate implements the whole
grammar.
As an extension, in addition to ASCII, we also recognize all UTF-8
text.
Further, we also allow dots in the name-addr Name. That is:
```
Professor Pippy P. Poopypants <pippy@jerome-horwitz.k12.oh.us>
```
is recognized. But [RFC 2822] strictly requires that the name be
quoted:
```
"Professor Pippy P. Poopypants" <pippy@jerome-horwitz.k12.oh.us>
```
This crate does not (yet) implement the new [RFC 5322].
[RFC 5322]: https://tools.ietf.org/html/rfc5322
|