This commit is contained in:
Mauro D
2022-07-15 13:49:17 +00:00
parent 6b23f08ee0
commit 4e49dff9e5
6 changed files with 34 additions and 3 deletions
+8
View File
@@ -1,3 +1,11 @@
mail-parser 0.5.0
================================
- `Message` headers are now stored as a `MessagePart` with index 0.
- Improved `MessagePart` API.
- Nested base64/quoted-printable encoded message/rfc822 parts are automatically parsed when calling `get_message`.
- Better handling of malformed MIME messages.
- Added raw offsets to MIME parts.
mail-parser 0.4.8
================================
- get_bytes_to_boundary fix (#21)
Generated
+1 -1
View File
@@ -81,7 +81,7 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
[[package]]
name = "mail-parser"
version = "0.4.8"
version = "0.5.0"
dependencies = [
"bincode",
"chrono",
+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "mail-parser"
description = "Fast and robust e-mail parsing library for Rust"
version = "0.4.8"
version = "0.5.0"
edition = "2018"
authors = [ "Stalwart Labs <hello@stalw.art>"]
license = "Apache-2.0 OR MIT"
+1 -1
View File
@@ -42,7 +42,7 @@ dependencies = [
[[package]]
name = "mail-parser"
version = "0.4.7"
version = "0.5.0"
dependencies = [
"encoding_rs",
"serde",
+22
View File
@@ -446,6 +446,14 @@ impl<'x> HeaderName<'x> {
HeaderName::Other(name) => name.into_owned(),
}
}
/// Returns true if it is a MIME header.
pub fn is_mime_header(&self) -> bool {
match self {
HeaderName::Rfc(header) => header.is_mime_header(),
HeaderName::Other(_) => false,
}
}
}
/// A header field
@@ -535,6 +543,20 @@ impl RfcHeader {
RfcHeader::ListUnsubscribe => "List-Unsubscribe",
}
}
/// Returns true if it is a MIME header.
pub fn is_mime_header(&self) -> bool {
matches!(
self,
RfcHeader::ContentDescription
| RfcHeader::ContentId
| RfcHeader::ContentLanguage
| RfcHeader::ContentLocation
| RfcHeader::ContentTransferEncoding
| RfcHeader::ContentType
| RfcHeader::ContentDisposition
)
}
}
impl Display for RfcHeader {
+1
View File
@@ -604,6 +604,7 @@ impl<'x> Message<'x> {
}
}
}
#[cfg(test)]
mod tests {
use std::{collections::BTreeMap, fs, path::PathBuf};