[Email-SIG] Mailgun email libraries

R. David Murray rdmurray at bitdance.com
Wed Aug 16 09:20:25 EDT 2017


On Tue, 15 Aug 2017 21:35:44 -0500, Matthew Dixon Cowles <matt at mondoinfo.com> wrote:
> [Barry]
> > This is mostly an FYI email since I've only had time to read the
> > blog post and briefly skim the docs, but there may be interesting
> > things we can learn from their work.
> 
> I've long been in favor of email module having an RFC 822 address
> parser. I've also long been of the opinion that RFC 822 was written

It always did have a minimal one, but it has a much better one now[1]:
email._header_value_parser, which handles more than just address headers.
The code is rather gnarly and needs to be rewritten for efficiency[2].
I would not object to replacing it by something better that someone got
paid to write[3], but that brings up the issue of maintenance...

Note that the new email policies also do one of the other bullet points
from the list in that blog post: the original header is preserved and
as long as it is not changed, the original is emitted on message
serialization.  (Unless you specify to reflow all headers in the
policy; but the default is preserve.)

> by out-of-work parser writers in the hopes of creating long-term
> demand for their services. (See section 3.3, "Lexical Tokens" and

Tell me about it.  On the other hand, once you add "Postel's rule"
processing, which you pretty much have to if you want to handle spam,
you are pretty much required to write a custom parser anyway, no matter
how clean the spec might be.

> what follows for the origin of that opinion.) That's one reason that
> I haven't sat down to write a real one to contribute to the module.
> 
> If theirs really does the job correctly, I think it would be a great
> idea to steal it.

Stealing has costs, but it is worth investigating for sure.

--David

[1] Well, except that unlike the old one the new one doesn't *actually*
handle comments, though the structure is there to support doing so and
they should be simply ignored in the meantime.  But no one has complained
yet that comment support isn't fully implemented.

[2] But before I even think about that I have a patch-in-progress to
finish that rewrites the gnarliest part of the code, which is the header
folding algorithm.

[3] Actually, Blackberry (then RIM) gave me a grant that funded about
half of the development of that parser.  But you get the point :)


More information about the Email-SIG mailing list