pub struct Message<'x> {
pub html_body: Vec<usize>,
pub text_body: Vec<usize>,
pub attachments: Vec<usize>,
pub parts: Vec<MessagePart<'x>>,
pub raw_message: Cow<'x, [u8]>,
}
Expand description
An RFC5322/RFC822 message.
Fields§
§html_body: Vec<usize>
§text_body: Vec<usize>
§attachments: Vec<usize>
§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<'_>>
pub fn header( &self, header: impl Into<HeaderName<'x>>, ) -> Option<&HeaderValue<'_>>
Returns a parsed header.
Sourcepub fn remove_header(
&mut self,
header: impl Into<HeaderName<'x>>,
) -> Option<HeaderValue<'_>>
pub fn remove_header( &mut self, header: impl Into<HeaderName<'x>>, ) -> Option<HeaderValue<'_>>
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<'_>]
pub fn headers(&self) -> &[Header<'_>]
Returns an iterator over the RFC headers of this message.
Sourcepub fn header_values<'y>(
&'y self,
name: impl Into<HeaderName<'x>>,
) -> impl Iterator<Item = &'y HeaderValue<'x>>where
'y: 'x,
pub fn header_values<'y>(
&'y self,
name: impl Into<HeaderName<'x>>,
) -> impl Iterator<Item = &'y HeaderValue<'x>>where
'y: '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 raw_message(&self) -> &[u8] ⓘ
pub fn raw_message(&self) -> &[u8] ⓘ
Returns the raw message
Sourcepub fn comments(&self) -> &HeaderValue<'_>
pub fn comments(&self) -> &HeaderValue<'_>
Returns all Comments header fields
Sourcepub fn from<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
pub fn from<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
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 references(&self) -> &HeaderValue<'_>
pub fn references(&self) -> &HeaderValue<'_>
Returns all References header fields
Sourcepub fn reply_to<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
pub fn reply_to<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
Returns the Reply-To header field
Sourcepub fn resent_bcc<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
pub fn resent_bcc<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
Returns the Resent-BCC header field
Sourcepub fn resent_cc<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
pub fn resent_cc<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
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<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
pub fn resent_from<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
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<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
pub fn resent_sender<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
Returns the Sender header field
Sourcepub fn resent_to<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
pub fn resent_to<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
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<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
pub fn sender<'y>(&'y self) -> Option<&'y Address<'x>>where
'y: 'x,
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 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(self) -> Message<'static>
pub fn into_owned(self) -> Message<'static>
Returns an owned version of the message