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>
Sourcepub fn root_part(&self) -> &MessagePart<'x>
pub fn root_part(&self) -> &MessagePart<'x>
Returns the root message part
Sourcepub fn header(
&self,
header: impl Into<HeaderName<'x>>,
) -> Option<&HeaderValue<'x>>
pub fn header( &self, header: impl Into<HeaderName<'x>>, ) -> Option<&HeaderValue<'x>>
Returns a parsed header.
Sourcepub fn remove_header(
&mut self,
header: impl Into<HeaderName<'x>>,
) -> Option<HeaderValue<'x>>
pub fn remove_header( &mut self, header: impl Into<HeaderName<'x>>, ) -> Option<HeaderValue<'x>>
Removed a parsed header and returns its value.
Sourcepub fn header_raw(&self, header: impl Into<HeaderName<'x>>) -> Option<&str>
pub fn header_raw(&self, header: impl Into<HeaderName<'x>>) -> Option<&str>
Returns the raw header.
pub fn header_as( &self, header: impl Into<HeaderName<'x>>, form: HeaderForm, ) -> Vec<HeaderValue<'_>>
Sourcepub fn headers(&self) -> &[Header<'x>]
pub fn headers(&self) -> &[Header<'x>]
Returns an iterator over the RFC headers of this message.
Sourcepub fn header_values(
&self,
name: impl Into<HeaderName<'x>>,
) -> impl Iterator<Item = &HeaderValue<'x>> + Sync + Send
pub fn header_values( &self, name: impl Into<HeaderName<'x>>, ) -> impl Iterator<Item = &HeaderValue<'x>> + Sync + Send
Returns an iterator over the matching RFC headers of this message.
Sourcepub fn headers_raw(&self) -> impl Iterator<Item = (&str, &str)> + Sync + Send
pub fn headers_raw(&self) -> impl Iterator<Item = (&str, &str)> + Sync + Send
Returns all headers in raw format
Sourcepub fn raw_message(&self) -> &[u8] ⓘ
pub fn raw_message(&self) -> &[u8] ⓘ
Returns the raw message
Sourcepub fn comments(&self) -> &HeaderValue<'x>
pub fn comments(&self) -> &HeaderValue<'x>
Returns all Comments header fields
Sourcepub fn in_reply_to(&self) -> &HeaderValue<'x>
pub fn in_reply_to(&self) -> &HeaderValue<'x>
Returns all In-Reply-To header fields
Sourcepub fn keywords(&self) -> &HeaderValue<'x>
pub fn keywords(&self) -> &HeaderValue<'x>
Returns all Keywords header fields
Sourcepub fn list_archive(&self) -> &HeaderValue<'x>
pub fn list_archive(&self) -> &HeaderValue<'x>
Returns the List-Archive header field
Sourcepub fn list_help(&self) -> &HeaderValue<'x>
pub fn list_help(&self) -> &HeaderValue<'x>
Returns the List-Help header field
Sourcepub fn list_id(&self) -> &HeaderValue<'x>
pub fn list_id(&self) -> &HeaderValue<'x>
Returns the List-ID header field
Sourcepub fn list_owner(&self) -> &HeaderValue<'x>
pub fn list_owner(&self) -> &HeaderValue<'x>
Returns the List-Owner header field
Sourcepub fn list_post(&self) -> &HeaderValue<'x>
pub fn list_post(&self) -> &HeaderValue<'x>
Returns the List-Post header field
Sourcepub fn list_subscribe(&self) -> &HeaderValue<'x>
pub fn list_subscribe(&self) -> &HeaderValue<'x>
Returns the List-Subscribe header field
Sourcepub fn list_unsubscribe(&self) -> &HeaderValue<'x>
pub fn list_unsubscribe(&self) -> &HeaderValue<'x>
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<'x>
pub fn mime_version(&self) -> &HeaderValue<'x>
Returns the MIME-Version header field
Sourcepub fn references(&self) -> &HeaderValue<'x>
pub fn references(&self) -> &HeaderValue<'x>
Returns all References header fields
Sourcepub fn resent_bcc(&self) -> Option<&Address<'x>>
pub fn resent_bcc(&self) -> Option<&Address<'x>>
Returns the Resent-BCC header field
Sourcepub fn resent_date(&self) -> &HeaderValue<'x>
pub fn resent_date(&self) -> &HeaderValue<'x>
Returns all Resent-Date header fields
Sourcepub fn resent_from(&self) -> Option<&Address<'x>>
pub fn resent_from(&self) -> Option<&Address<'x>>
Returns the Resent-From header field
Sourcepub fn resent_message_id(&self) -> &HeaderValue<'x>
pub fn resent_message_id(&self) -> &HeaderValue<'x>
Returns all Resent-Message-ID header fields
Sourcepub fn resent_sender(&self) -> Option<&Address<'x>>
pub fn resent_sender(&self) -> Option<&Address<'x>>
Returns the Sender header field
Sourcepub fn return_path(&self) -> &HeaderValue<'x>
pub fn return_path(&self) -> &HeaderValue<'x>
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 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 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: u32) -> Option<&MessagePart<'x>>
pub fn part(&self, pos: u32) -> Option<&MessagePart<'x>>
Returns a message part by position
Sourcepub fn html_part(&self, pos: u32) -> Option<&MessagePart<'x>>
pub fn html_part(&self, pos: u32) -> Option<&MessagePart<'x>>
Returns an inline HTML body part by position
Sourcepub fn text_part(&self, pos: u32) -> Option<&MessagePart<'x>>
pub fn text_part(&self, pos: u32) -> Option<&MessagePart<'x>>
Returns an inline text body part by position
Sourcepub fn attachment(&self, pos: u32) -> Option<&MessagePart<'x>>
pub fn attachment(&self, pos: u32) -> 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(
&self,
) -> impl Iterator<Item = &MessagePart<'_>> + Sync + Send
pub fn text_bodies( &self, ) -> impl Iterator<Item = &MessagePart<'_>> + Sync + Send
Returns an Interator over the text body parts
Sourcepub fn html_bodies(
&self,
) -> impl Iterator<Item = &MessagePart<'_>> + Sync + Send
pub fn html_bodies( &self, ) -> impl Iterator<Item = &MessagePart<'_>> + Sync + Send
Returns an Interator over the HTML body parts
Sourcepub fn attachments(
&self,
) -> impl Iterator<Item = &MessagePart<'_>> + Sync + Send
pub fn attachments( &self, ) -> impl Iterator<Item = &MessagePart<'_>> + Sync + Send
Returns an Interator over the attachments
Sourcepub fn into_owned(self) -> Message<'static>
pub fn into_owned(self) -> Message<'static>
Returns an owned version of the message