Library for handling mail.
| feature flag | dependencies | notes |
|------------------------------|-------------------------------------|--------------------------|
| smtp
| native-tls
, base64
| async SMTP communication |
|------------------------------|-------------------------------------|--------------------------|
| imap
| native-tls
| |
|------------------------------|-------------------------------------|--------------------------|
| jmap
| isahc
, native-tls
, serde_json
| |
|------------------------------|-------------------------------------|--------------------------|
| maildir
| notify
| |
|------------------------------|-------------------------------------|--------------------------|
| mbox
| notify
| |
|------------------------------|-------------------------------------|--------------------------|
| notmuch
| notify
| |
|------------------------------|-------------------------------------|--------------------------|
| sqlite
| rusqlite
| Used in IMAP cache. |
|------------------------------|-------------------------------------|--------------------------|
| unicode-algorithms
| unicode-segmentation
| Linebreaking algo etc |
| | | For a fresh clean build, |
| | | Network access is |
| | | required to fetch data |
| | | from Unicode's website. |
|------------------------------|-------------------------------------|--------------------------|
| unicode-algorithms-cached
| unicode-segmentation
| Linebreaking algo etc |
| | | but it uses a cached |
| | | version of Unicode data |
| | | which might be stale. |
| | | |
| | | Use this feature instead |
| | | of the previous one for |
| | | building without network |
| | | access. |
|------------------------------|-------------------------------------|--------------------------|
| unicode-algorithms
| unicode-segmentation
| |
|------------------------------|-------------------------------------|--------------------------|
| vcard
| | vcard parsing |
|------------------------------|-------------------------------------|--------------------------|
| gpgme
| | GPG use with libgpgme |
|------------------------------|-------------------------------------|--------------------------|
Envelope
An Envelope
represents the information you can get from an email's headers
and body structure. Addresses in To
, From
fields etc are parsed into
Address
types.
```rust use melib::{Attachment, Envelope};
let rawmail = r#"From: "some name" some@example.com To: "me" myself@example.com Cc: Subject: =?utf-8?Q?gratuitouslyencodedsubject?= Message-ID: h2g7f.z0gy2pgaen5m@example.com MIME-Version: 1.0 Content-Type: multipart/mixed; charset="utf-8"; boundary="bzzbzzbzz"
This is a MIME formatted message with attachments. Use a MIME-compliant client to view it properly. --bzz_bzzbzz
hello world. --bzzbzzbzz Content-Type: image/gif; name="testimage.gif"; charset="utf-8" Content-Disposition: attachment Content-Transfer-Encoding: base64
R0lGODdhKAAXAOfZAAABzAADzQAEzgQFtBEAxAAGxBcAxwALvRcFwAAPwBcLugATuQEUuxoNuxYQ sxwOvAYVvBsStSAVtx8YsRUcuhwhth4iuCQsyDAwuDc1vTc3uDg4uT85rkc9ukJBvENCvURGukdF wUVKt0hLuUxPvVZSvFlYu1hbt2BZuFxdul5joGhqlnNuf3FvlnBvwXJyt3Jxw3N0oXx1gH12gV99 z317f3N7spFxwHp5wH99gYB+goF/g25+26tziIOBhWqD3oiBjICAuudkjIN+zHeC2n6Bzc1vh4eF iYaBw8F0kImHi4KFxYyHmIWIvI2Lj4uIvYaJyY+IuJGMi5iJl4qKxZSMmIuLxpONnpGPk42NvI2M 1LKGl46OvZePm5ORlZiQnJqSnpaUmLyJnJuTn5iVmZyUoJGVyZ2VoZSVw5iXoZmWrO18rJiUyp6W opuYnKaVnZ+Xo5yZncaMoaCYpJiaqo+Z2Z2annuf5qGZpa2WoJybpZmayZ2Z0KCZypydrZ6dp6Cd oZ6a0aGay5ucy5+eqKGeouWMgp+b0qKbzKCfqdqPnp2ezaGgqqOgpKafqrScpp+gz6ajqKujr62j qayksKmmq62lsaiosqqorOyWnaqqtKeqzLGptaurta2rr7Kqtq+ssLOrt6+uuLGusuqhfbWtubCv ubKvs7GwurOwtPSazbevu+ali7SxtbiwvOykjLOyvLWytuCmqOankrSzvbazuLmyvrW0vre0uba1 wLi1ury0wLm2u721wbe3wbq3vMC2vLi4wr+3w7m5w8C4xLi6yry6vsG5xbu7xcC6zMK6xry8xry+ u8O7x729x8C9wb++yMG+wsO+vMK/w8a+y8e/zMnBzcXH18nL2/////////////////////////// //////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////ywAAAAAKAAXAAAI/gBP4Cjh IYMLEh0w4EgBgsMLEyFGFBEB5cOFABgzatS4AVssZAOsLOHCxooVMzCyoNmzaBOkJlS0VEDyZMjG mxk3XOMF60CDBgsoPABK9KcDCRImPCiQYAECAgQCRMU4VSrGCjFarBgUSJCgQ10FBTrkNRCfPnz4 dA3UNa1btnDZqgU7Ntqzu3ej2X2mFy9eaHuhNRtMGJrhwYYN930G2K7eaNIY34U2mfJkwpgzI9Yr GBqwR2KSvAlMOXHnw5pTNzPdLNoWIWtU9XjGjDEYS8LAlFm1SrVvzIKj5TH0KpORSZOryPgCZgqL Ob+jG0YVRBErUrOiiGJ8KxgtYsh27xWL/tswnTtEbsiRVYdJNMHk4yOGhswGjR88UKjQ9Ey+/8TL XKKGGn7Akph/8XX2WDTTcAYfguVt9hhrEPqmzIOJ3VUheb48WJiHG6amC4i+WVJKKCimqGIoYxyj WWK8kKjaJ9bA18sxvXjYhourmbbMMrjI+OIn1QymDCVXANGFK4S1gQw0PxozzC+33FLLKUJq9gk1 gyWDhyNwrMLkYGUEM4wvuLRiCiieXIJJJVlmJskcZ9TZRht1lnFGGmTMkMoonVQSSSOFAGJHHI0w ouiijDaaCCGQRgrpH3q4QYYXWDihxBE+7KCDDjnUIEVAADs= --bzz_bzzbzz--"#;
let envelope = Envelope::frombytes(rawmail.asbytes(), None).expect("Could not parse mail"); asserteq!(envelope.subject().asref(), "gratuitously encoded subject"); asserteq!(envelope.messageiddisplay().as_ref(), "h2g7f.z0gy2pgaen5m@example.com");
let body = envelope.bodybytes(rawmail.asbytes()); asserteq!(body.contenttype().tostring().as_str(), "multipart/mixed");
let bodytext = body.text(); asserteq!(bodytext.asstr(), "hello world.");
let subattachments: Vec