#rfc822 #rfc2822 #name-addr

yanked sequoia-rfc2822

An RFC 2822 name-addr parser

0.10.0 Sep 6, 2019
0.9.0 Jul 8, 2019
0.8.0 Jun 14, 2019
0.7.0 May 10, 2019
0.6.0 Apr 12, 2019

#10 in #rfc822

Download history 17/week @ 2024-08-25 15/week @ 2024-09-01 17/week @ 2024-09-08 7/week @ 2024-09-15 24/week @ 2024-09-22 25/week @ 2024-09-29 24/week @ 2024-10-06 22/week @ 2024-10-13 16/week @ 2024-10-20 17/week @ 2024-10-27 13/week @ 2024-11-03 18/week @ 2024-11-10 24/week @ 2024-11-17 19/week @ 2024-11-24 24/week @ 2024-12-01 39/week @ 2024-12-08

108 downloads per month

GPL-3.0 license

110KB
2.5K SLoC

An RFC 2822 parser.

Currently, this crate only recognizes the RFC 2822 name-addr and addr-spec productions, i.e., things of the form:

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 code points. NUL, controls, and specials retain their meaning as defined in RFC 2822. Other UTF-8 code points are considered to be text like a.

Further, we also allow dots (.) and at symbols (@) in the atom production. That is, the atom production is extended from:

atom            =       [CFWS] 1*atext [CFWS]

to:

atom               =       [CFWS] 1*atext_or_dot_or_at [CFWS]
atext_or_dot_or_at =       atext | DOT | AT

And, as such:

Professor Pippy P. Poopypants <pippy@jerome-horwitz.k12.oh.us>

is recognized as a name-addr even though RFC 2822 strictly requires that the display-name be quoted like:

"Professor Pippy P. Poopypants" <pippy@jerome-horwitz.k12.oh.us>

Likewise,

foo@bar.com <foo@bar.com>

is recognized as a name-addr even though the @ should be quoted.

This crate does not (yet) implement the new RFC 5322.

Dependencies

~0.1–1.2MB
~23K SLoC