stalwartlabs / mail-parser

Fast and robust e-mail parsing library for Rust
https://docs.rs/mail-parser/
Apache License 2.0
290 stars 39 forks source link

How does this crate relate to mailparse crate? #33

Closed hpk42 closed 1 year ago

hpk42 commented 1 year ago

Was a bit surprised to find this crate here as there already is the nice https://docs.rs/mailparse/latest/mailparse/ that is used in production from the https://github.com/deltachat apps. Could you maybe detail in the README or here how the two relate? There might very well be good reasons to do a separate effort but still useful to understand especially that the two are naming wise so close to another ;)

mdecimus commented 1 year ago

I haven't looked into mailparse in detail but looking at their Github repo it looks like it is not fully RFC5322 or MIME compliant:

The library is designed to process real-world email data such as might be obtained by using the FETCH command on an IMAP server, or in a Maildir. As such, this library should successfully handle any valid MIME-formatted message, although it may not follow all the strict requirements in the various specifications that cover the format (predominantly IETF RFCs 822, 2045, 2047, 2822, and 5322). As an example, this library accepts raw message data which uses \n (ASCII LF) as line delimiters rather than the RFC-mandated \r\n (ASCII CRLF) line delimiters.

Also, looking at mailparse's source code it looks like their implementation is quite naive and not as robust as mail-parser. In addition to that they do not seem to support as many encodings as mail-parser, even though nowadays almost all emails are in UTF-8.