Struct mail_parser::Message
source · pub struct Message<'x> {
pub html_body: Vec<MessagePartId>,
pub text_body: Vec<MessagePartId>,
pub attachments: Vec<MessagePartId>,
pub parts: Vec<MessagePart<'x>>,
pub raw_message: Cow<'x, [u8]>,
}
Expand description
An RFC5322/RFC822 message.
Fields§
§html_body: Vec<MessagePartId>
§text_body: Vec<MessagePartId>
§attachments: Vec<MessagePartId>
§parts: Vec<MessagePart<'x>>
§raw_message: Cow<'x, [u8]>
Implementations§
source§impl<'x> Message<'x>
impl<'x> Message<'x>
source§impl<'x> Message<'x>
impl<'x> Message<'x>
sourcepub fn root_part(&self) -> &MessagePart<'x>
pub fn root_part(&self) -> &MessagePart<'x>
Returns the root message part
sourcepub fn header(&self, header: &str) -> Option<&HeaderValue<'_>>
pub fn header(&self, header: &str) -> Option<&HeaderValue<'_>>
Returns a parsed header.
sourcepub fn remove_header(&mut self, header: &str) -> Option<HeaderValue<'_>>
pub fn remove_header(&mut self, header: &str) -> Option<HeaderValue<'_>>
Removed a parsed header and returns its value.
sourcepub fn remove_header_rfc(&mut self, header: RfcHeader) -> Option<HeaderValue<'_>>
pub fn remove_header_rfc(&mut self, header: RfcHeader) -> Option<HeaderValue<'_>>
Removed a parsed RFC heade and returns its value.
sourcepub fn header_raw(&self, header: &str) -> Option<&str>
pub fn header_raw(&self, header: &str) -> Option<&str>
Returns the raw header.
sourcepub fn headers(&self) -> &[Header<'_>]
pub fn headers(&self) -> &[Header<'_>]
Returns an iterator over the RFC headers of this message.
sourcepub fn header_values<'y: 'x>(
&'y self,
name: RfcHeader
) -> impl Iterator<Item = &HeaderValue<'x>>
pub fn header_values<'y: 'x>(
&'y self,
name: RfcHeader
) -> impl Iterator<Item = &HeaderValue<'x>>
Returns an iterator over the matching RFC headers of this message.
sourcepub fn headers_raw(&self) -> impl Iterator<Item = (&str, &str)>
pub fn headers_raw(&self) -> impl Iterator<Item = (&str, &str)>
Returns all headers in raw format
sourcepub fn bcc(&self) -> &HeaderValue<'_>
pub fn bcc(&self) -> &HeaderValue<'_>
Returns the BCC header field
sourcepub fn cc(&self) -> &HeaderValue<'_>
pub fn cc(&self) -> &HeaderValue<'_>
Returns the CC header field
sourcepub fn comments(&self) -> &HeaderValue<'_>
pub fn comments(&self) -> &HeaderValue<'_>
Returns all Comments header fields
sourcepub fn from(&self) -> &HeaderValue<'_>
pub fn from(&self) -> &HeaderValue<'_>
Returns the From header field
sourcepub fn in_reply_to(&self) -> &HeaderValue<'_>
pub fn in_reply_to(&self) -> &HeaderValue<'_>
Returns all In-Reply-To header fields
sourcepub fn keywords(&self) -> &HeaderValue<'_>
pub fn keywords(&self) -> &HeaderValue<'_>
Returns all Keywords header fields
sourcepub fn list_archive(&self) -> &HeaderValue<'_>
pub fn list_archive(&self) -> &HeaderValue<'_>
Returns the List-Archive header field
sourcepub fn list_help(&self) -> &HeaderValue<'_>
pub fn list_help(&self) -> &HeaderValue<'_>
Returns the List-Help header field
sourcepub fn list_id(&self) -> &HeaderValue<'_>
pub fn list_id(&self) -> &HeaderValue<'_>
Returns the List-ID header field
sourcepub fn list_owner(&self) -> &HeaderValue<'_>
pub fn list_owner(&self) -> &HeaderValue<'_>
Returns the List-Owner header field
sourcepub fn list_post(&self) -> &HeaderValue<'_>
pub fn list_post(&self) -> &HeaderValue<'_>
Returns the List-Post header field
sourcepub fn list_subscribe(&self) -> &HeaderValue<'_>
pub fn list_subscribe(&self) -> &HeaderValue<'_>
Returns the List-Subscribe header field
sourcepub fn list_unsubscribe(&self) -> &HeaderValue<'_>
pub fn list_unsubscribe(&self) -> &HeaderValue<'_>
Returns the List-Unsubscribe header field
sourcepub fn message_id(&self) -> Option<&str>
pub fn message_id(&self) -> Option<&str>
Returns the Message-ID header field
sourcepub fn mime_version(&self) -> &HeaderValue<'_>
pub fn mime_version(&self) -> &HeaderValue<'_>
Returns the MIME-Version header field
sourcepub fn received(&self) -> &HeaderValue<'_>
pub fn received(&self) -> &HeaderValue<'_>
Returns all Received header fields
sourcepub fn references(&self) -> &HeaderValue<'_>
pub fn references(&self) -> &HeaderValue<'_>
Returns all References header fields
sourcepub fn reply_to(&self) -> &HeaderValue<'_>
pub fn reply_to(&self) -> &HeaderValue<'_>
Returns the Reply-To header field
sourcepub fn resent_bcc(&self) -> &HeaderValue<'_>
pub fn resent_bcc(&self) -> &HeaderValue<'_>
Returns the Resent-BCC header field
sourcepub fn resent_cc(&self) -> &HeaderValue<'_>
pub fn resent_cc(&self) -> &HeaderValue<'_>
Returns the Resent-CC header field
sourcepub fn resent_date(&self) -> &HeaderValue<'_>
pub fn resent_date(&self) -> &HeaderValue<'_>
Returns all Resent-Date header fields
sourcepub fn resent_from(&self) -> &HeaderValue<'_>
pub fn resent_from(&self) -> &HeaderValue<'_>
Returns the Resent-From header field
sourcepub fn resent_message_id(&self) -> &HeaderValue<'_>
pub fn resent_message_id(&self) -> &HeaderValue<'_>
Returns all Resent-Message-ID header fields
sourcepub fn resent_sender(&self) -> &HeaderValue<'_>
pub fn resent_sender(&self) -> &HeaderValue<'_>
Returns the Sender header field
sourcepub fn resent_to(&self) -> &HeaderValue<'_>
pub fn resent_to(&self) -> &HeaderValue<'_>
Returns the Resent-To header field
sourcepub fn return_path(&self) -> &HeaderValue<'_>
pub fn return_path(&self) -> &HeaderValue<'_>
Returns all Return-Path header fields
sourcepub fn return_address(&self) -> Option<&str>
pub fn return_address(&self) -> Option<&str>
Returns the return address from either the Return-Path or From header fields
sourcepub fn sender(&self) -> &HeaderValue<'_>
pub fn sender(&self) -> &HeaderValue<'_>
Returns the Sender header field
sourcepub fn thread_name(&self) -> Option<&str>
pub fn thread_name(&self) -> Option<&str>
Returns the message thread name or ‘base subject’ as defined in RFC 5957 - Internet Message Access Protocol - SORT and THREAD Extensions (Section 2.1)
sourcepub fn to(&self) -> &HeaderValue<'_>
pub fn to(&self) -> &HeaderValue<'_>
Returns the To header field
sourcepub fn body_preview(&self, preview_len: usize) -> Option<Cow<'x, str>>
pub fn body_preview(&self, preview_len: usize) -> Option<Cow<'x, str>>
Returns a preview of the message body
sourcepub fn body_html(&'x self, pos: usize) -> Option<Cow<'x, str>>
pub fn body_html(&'x self, pos: usize) -> Option<Cow<'x, str>>
Returns a message body part as text/plain
sourcepub fn body_text(&'x self, pos: usize) -> Option<Cow<'x, str>>
pub fn body_text(&'x self, pos: usize) -> Option<Cow<'x, str>>
Returns a message body part as text/plain
sourcepub fn part(&self, pos: usize) -> Option<&MessagePart<'_>>
pub fn part(&self, pos: usize) -> Option<&MessagePart<'_>>
Returns a message part by position
sourcepub fn html_part(&self, pos: usize) -> Option<&MessagePart<'_>>
pub fn html_part(&self, pos: usize) -> Option<&MessagePart<'_>>
Returns an inline HTML body part by position
sourcepub fn text_part(&self, pos: usize) -> Option<&MessagePart<'_>>
pub fn text_part(&self, pos: usize) -> Option<&MessagePart<'_>>
Returns an inline text body part by position
sourcepub fn attachment(&self, pos: usize) -> Option<&MessagePart<'x>>
pub fn attachment(&self, pos: usize) -> Option<&MessagePart<'x>>
Returns an attacment by position
sourcepub fn text_body_count(&self) -> usize
pub fn text_body_count(&self) -> usize
Returns the number of plain text body parts
sourcepub fn html_body_count(&self) -> usize
pub fn html_body_count(&self) -> usize
Returns the number of HTML body parts
sourcepub fn attachment_count(&self) -> usize
pub fn attachment_count(&self) -> usize
Returns the number of attachments
sourcepub fn text_bodies(&'x self) -> BodyPartIterator<'x>
pub fn text_bodies(&'x self) -> BodyPartIterator<'x>
Returns an Interator over the text body parts
sourcepub fn html_bodies(&'x self) -> BodyPartIterator<'x>
pub fn html_bodies(&'x self) -> BodyPartIterator<'x>
Returns an Interator over the HTML body parts
sourcepub fn attachments(&'x self) -> AttachmentIterator<'x>
pub fn attachments(&'x self) -> AttachmentIterator<'x>
Returns an Interator over the attachments
sourcepub fn into_owned<'y>(self) -> Message<'y>
pub fn into_owned<'y>(self) -> Message<'y>
Returns an owned version of the message