Skip to content

Commit 4e49dff

Browse files
committed
v0.5.0
1 parent 6b23f08 commit 4e49dff

File tree

6 files changed

+34
-3
lines changed

6 files changed

+34
-3
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
mail-parser 0.5.0
2+
================================
3+
- `Message` headers are now stored as a `MessagePart` with index 0.
4+
- Improved `MessagePart` API.
5+
- Nested base64/quoted-printable encoded message/rfc822 parts are automatically parsed when calling `get_message`.
6+
- Better handling of malformed MIME messages.
7+
- Added raw offsets to MIME parts.
8+
19
mail-parser 0.4.8
210
================================
311
- get_bytes_to_boundary fix (#21)

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "mail-parser"
33
description = "Fast and robust e-mail parsing library for Rust"
4-
version = "0.4.8"
4+
version = "0.5.0"
55
edition = "2018"
66
authors = [ "Stalwart Labs <hello@stalw.art>"]
77
license = "Apache-2.0 OR MIT"

fuzz/Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib.rs

+22
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,14 @@ impl<'x> HeaderName<'x> {
446446
HeaderName::Other(name) => name.into_owned(),
447447
}
448448
}
449+
450+
/// Returns true if it is a MIME header.
451+
pub fn is_mime_header(&self) -> bool {
452+
match self {
453+
HeaderName::Rfc(header) => header.is_mime_header(),
454+
HeaderName::Other(_) => false,
455+
}
456+
}
449457
}
450458

451459
/// A header field
@@ -535,6 +543,20 @@ impl RfcHeader {
535543
RfcHeader::ListUnsubscribe => "List-Unsubscribe",
536544
}
537545
}
546+
547+
/// Returns true if it is a MIME header.
548+
pub fn is_mime_header(&self) -> bool {
549+
matches!(
550+
self,
551+
RfcHeader::ContentDescription
552+
| RfcHeader::ContentId
553+
| RfcHeader::ContentLanguage
554+
| RfcHeader::ContentLocation
555+
| RfcHeader::ContentTransferEncoding
556+
| RfcHeader::ContentType
557+
| RfcHeader::ContentDisposition
558+
)
559+
}
538560
}
539561

540562
impl Display for RfcHeader {

src/parsers/message.rs

+1
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ impl<'x> Message<'x> {
604604
}
605605
}
606606
}
607+
607608
#[cfg(test)]
608609
mod tests {
609610
use std::{collections::BTreeMap, fs, path::PathBuf};

0 commit comments

Comments
 (0)