Email parsing library with a focus on reliably handling malformed data
[Latest documentation]
Features: * [Python module] * Email header parsing * ESMTP command parsing * Unit testing with a high coverage * Supports internationalized email headers through [RFC 2047] and [RFC 2231] decoding * Used to parse the content of millions of emails every day * [SMTPUTF8] support * [UTF-8 Internationalized Email Headers] support
Roadmap: * Decoding of all common ESMTP extensions * Support more email content syntax
```rust use rustyknife::behaviour::Intl; use rustyknife::types::{DomainPart, DotAtom, Mailbox}; use rustyknife::rfc5322::{Address, Group, Mailbox as IMFMailbox}; use rustyknife::rfc5322::from;
let (rem, parsed) = from::
// rem
contains the unparsed remainder.
assert!(rem.isempty());
asserteq!(parsed, [Address::Group(Group{
dname: "A Group".into(),
members: vec![
IMFMailbox { dname: Some("Chris Jones".into()),
address: Mailbox::fromimf(b"c@public.example").unwrap() },
IMFMailbox { dname: None,
address: Mailbox::fromimf(b"joe@example.org").unwrap() },
IMFMailbox { dname: Some("John".into()),
address: Mailbox::from_imf(b"jdoe@one.test").unwrap() }
]
})]);
```
```rust use rustyknife::behaviour::Intl; use rustyknife::types::{Mailbox, QuotedString, Domain}; use rustyknife::rfc5321::{mail_command, Path, ReversePath, Param};
let (, (path, params)) = mailcommand::
rust
use rustyknife::rfc2047::encoded_word;
let (_, decoded) = encoded_word(b"=?x-sjis?B?lEWWQI7Kg4GM9ZTygs6CtSiPzik=?=").unwrap();
assert_eq!(decoded, "忍法写メ光飛ばし(笑)");