Added raw_message() function

This commit is contained in:
Mauro D
2023-02-09 00:08:30 +00:00
parent c7ae90b3bf
commit cf8de086c7
3 changed files with 13 additions and 1 deletions
+4
View File
@@ -1,3 +1,7 @@
mail-parser 0.8.1
================================
- Added `raw_message()` function.
mail-parser 0.8.0
================================
- Removed get_() prefixes (#31).
+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "mail-parser"
description = "Fast and robust e-mail parsing library for Rust"
version = "0.8.0"
version = "0.8.1"
edition = "2018"
authors = [ "Stalwart Labs <hello@stalw.art>"]
license = "Apache-2.0 OR MIT"
+8
View File
@@ -983,6 +983,14 @@ impl<'x> Message<'x> {
})
}
/// Returns the raw message
pub fn raw_message(&self) -> &[u8] {
let part = &self.parts[0];
self.raw_message
.get(part.offset_header..part.offset_end)
.unwrap_or_default()
}
/// Returns the BCC header field
pub fn bcc(&self) -> &HeaderValue {
self.parts[0]