mirror of
https://github.com/stalwartlabs/mail-parser.git
synced 2026-11-29 08:01:21 +00:00
fix: return all To, Cc, Bcc headers (#152)
This commit is contained in:
@@ -128,6 +128,12 @@ impl<'x> Message<'x> {
|
||||
.and_then(|a| a.as_address())
|
||||
}
|
||||
|
||||
/// Returns all BCC header fields, permitted by [4.5.3 Obsolete Destination Address Fields](https://www.rfc-editor.org/info/rfc5322/#section-4.5.3)
|
||||
pub fn all_bcc(&self) -> impl Iterator<Item = &Address<'x>> {
|
||||
self.header_values(HeaderName::Bcc)
|
||||
.filter_map(|a| a.as_address())
|
||||
}
|
||||
|
||||
/// Returns the CC header field
|
||||
pub fn cc(&self) -> Option<&Address<'x>> {
|
||||
self.parts[0]
|
||||
@@ -136,6 +142,12 @@ impl<'x> Message<'x> {
|
||||
.and_then(|a| a.as_address())
|
||||
}
|
||||
|
||||
/// Returns all CC header fields, permitted by [4.5.3 Obsolete Destination Address Fields](https://www.rfc-editor.org/info/rfc5322/#section-4.5.3)
|
||||
pub fn all_cc(&self) -> impl Iterator<Item = &Address<'x>> {
|
||||
self.header_values(HeaderName::Cc)
|
||||
.filter_map(|a| a.as_address())
|
||||
}
|
||||
|
||||
/// Returns all Comments header fields
|
||||
pub fn comments(&self) -> &HeaderValue<'x> {
|
||||
self.parts[0]
|
||||
@@ -386,6 +398,12 @@ impl<'x> Message<'x> {
|
||||
.and_then(|a| a.as_address())
|
||||
}
|
||||
|
||||
/// Returns all To header fields, permitted by [4.5.3 Obsolete Destination Address Fields](https://www.rfc-editor.org/info/rfc5322/#section-4.5.3)
|
||||
pub fn all_to(&self) -> impl Iterator<Item = &Address<'x>> {
|
||||
self.header_values(HeaderName::To)
|
||||
.filter_map(|a| a.as_address())
|
||||
}
|
||||
|
||||
/// Returns a preview of the message body
|
||||
pub fn body_preview(&self, preview_len: usize) -> Option<Cow<'x, str>> {
|
||||
if !self.text_body.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user