Struct mail_parser::Message
source · [−]pub struct Message<'x> {
pub headers_rfc: RfcHeaders<'x>,
pub headers_raw: RawHeaders<'x>,
pub html_body: Vec<MessagePartId>,
pub text_body: Vec<MessagePartId>,
pub attachments: Vec<MessagePartId>,
pub parts: Vec<MessagePart<'x>>,
pub structure: MessageStructure,
pub offset_header: usize,
pub offset_body: usize,
pub offset_end: usize,
pub raw_message: Cow<'x, [u8]>,
}
Expand description
An RFC5322/RFC822 message.
Fields
headers_rfc: RfcHeaders<'x>
headers_raw: RawHeaders<'x>
html_body: Vec<MessagePartId>
text_body: Vec<MessagePartId>
attachments: Vec<MessagePartId>
parts: Vec<MessagePart<'x>>
structure: MessageStructure
offset_header: usize
offset_body: usize
offset_end: usize
raw_message: Cow<'x, [u8]>
Implementations
sourceimpl<'x> Message<'x>
impl<'x> Message<'x>
sourceimpl<'x> Message<'x>
impl<'x> Message<'x>
sourcepub fn get_header(&self, header: &RfcHeader) -> Option<&HeaderValue<'_>>
pub fn get_header(&self, header: &RfcHeader) -> Option<&HeaderValue<'_>>
Returns a parsed RFC header.
sourcepub fn get_headers_rfc(
&self
) -> impl Iterator<Item = (&RfcHeader, &HeaderValue<'x>)>
pub fn get_headers_rfc(
&self
) -> impl Iterator<Item = (&RfcHeader, &HeaderValue<'x>)>
Returns an iterator over the RFC headers of this message.
sourcepub fn get_bcc(&self) -> &HeaderValue<'x>
pub fn get_bcc(&self) -> &HeaderValue<'x>
Returns the BCC header field
sourcepub fn get_cc(&self) -> &HeaderValue<'x>
pub fn get_cc(&self) -> &HeaderValue<'x>
Returns the CC header field
sourcepub fn get_comments(&self) -> &HeaderValue<'x>
pub fn get_comments(&self) -> &HeaderValue<'x>
Returns all Comments header fields
sourcepub fn get_from(&self) -> &HeaderValue<'x>
pub fn get_from(&self) -> &HeaderValue<'x>
Returns the From header field
sourcepub fn get_in_reply_to(&self) -> &HeaderValue<'x>
pub fn get_in_reply_to(&self) -> &HeaderValue<'x>
Returns all In-Reply-To header fields
sourcepub fn get_keywords(&self) -> &HeaderValue<'x>
pub fn get_keywords(&self) -> &HeaderValue<'x>
Returns all Keywords header fields
sourcepub fn get_list_archive(&self) -> &HeaderValue<'x>
pub fn get_list_archive(&self) -> &HeaderValue<'x>
Returns the List-Archive header field
sourcepub fn get_list_help(&self) -> &HeaderValue<'x>
pub fn get_list_help(&self) -> &HeaderValue<'x>
Returns the List-Help header field
sourcepub fn get_list_id(&self) -> &HeaderValue<'x>
pub fn get_list_id(&self) -> &HeaderValue<'x>
Returns the List-ID header field
sourcepub fn get_list_owner(&self) -> &HeaderValue<'x>
pub fn get_list_owner(&self) -> &HeaderValue<'x>
Returns the List-Owner header field
sourcepub fn get_list_post(&self) -> &HeaderValue<'x>
pub fn get_list_post(&self) -> &HeaderValue<'x>
Returns the List-Post header field
sourcepub fn get_list_subscribe(&self) -> &HeaderValue<'x>
pub fn get_list_subscribe(&self) -> &HeaderValue<'x>
Returns the List-Subscribe header field
sourcepub fn get_list_unsubscribe(&self) -> &HeaderValue<'x>
pub fn get_list_unsubscribe(&self) -> &HeaderValue<'x>
Returns the List-Unsubscribe header field
sourcepub fn get_message_id(&self) -> Option<&str>
pub fn get_message_id(&self) -> Option<&str>
Returns the Message-ID header field
sourcepub fn get_mime_version(&self) -> &HeaderValue<'x>
pub fn get_mime_version(&self) -> &HeaderValue<'x>
Returns the MIME-Version header field
sourcepub fn get_received(&self) -> &HeaderValue<'x>
pub fn get_received(&self) -> &HeaderValue<'x>
Returns all Received header fields
sourcepub fn get_references(&self) -> &HeaderValue<'x>
pub fn get_references(&self) -> &HeaderValue<'x>
Returns all References header fields
sourcepub fn get_reply_to(&self) -> &HeaderValue<'x>
pub fn get_reply_to(&self) -> &HeaderValue<'x>
Returns the Reply-To header field
sourcepub fn get_resent_bcc(&self) -> &HeaderValue<'x>
pub fn get_resent_bcc(&self) -> &HeaderValue<'x>
Returns the Resent-BCC header field
sourcepub fn get_resent_cc(&self) -> &HeaderValue<'x>
pub fn get_resent_cc(&self) -> &HeaderValue<'x>
Returns the Resent-CC header field
sourcepub fn get_resent_date(&self) -> &HeaderValue<'x>
pub fn get_resent_date(&self) -> &HeaderValue<'x>
Returns all Resent-Date header fields
sourcepub fn get_resent_from(&self) -> &HeaderValue<'x>
pub fn get_resent_from(&self) -> &HeaderValue<'x>
Returns the Resent-From header field
sourcepub fn get_resent_message_id(&self) -> &HeaderValue<'x>
pub fn get_resent_message_id(&self) -> &HeaderValue<'x>
Returns all Resent-Message-ID header fields
sourcepub fn get_resent_sender(&self) -> &HeaderValue<'x>
pub fn get_resent_sender(&self) -> &HeaderValue<'x>
Returns the Sender header field
sourcepub fn get_resent_to(&self) -> &HeaderValue<'x>
pub fn get_resent_to(&self) -> &HeaderValue<'x>
Returns the Resent-To header field
sourcepub fn get_return_path(&self) -> &HeaderValue<'x>
pub fn get_return_path(&self) -> &HeaderValue<'x>
Returns all Return-Path header fields
sourcepub fn get_return_address(&self) -> Option<&str>
pub fn get_return_address(&self) -> Option<&str>
Returns the return address from either the Return-Path or From header fields
sourcepub fn get_sender(&self) -> &HeaderValue<'x>
pub fn get_sender(&self) -> &HeaderValue<'x>
Returns the Sender header field
sourcepub fn get_subject(&self) -> Option<&str>
pub fn get_subject(&self) -> Option<&str>
Returns the Subject header field
sourcepub fn get_thread_name(&self) -> Option<&str>
pub fn get_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 get_to(&self) -> &HeaderValue<'x>
pub fn get_to(&self) -> &HeaderValue<'x>
Returns the To header field
sourcepub fn get_body_preview(&self, preview_len: usize) -> Option<Cow<'x, str>>
pub fn get_body_preview(&self, preview_len: usize) -> Option<Cow<'x, str>>
Returns a preview of the message body
sourcepub fn get_raw_headers(
&self
) -> impl Iterator<Item = (&HeaderName<'_>, Cow<'_, str>)>
pub fn get_raw_headers(
&self
) -> impl Iterator<Item = (&HeaderName<'_>, Cow<'_, str>)>
Returns all headers in raw format
pub fn _get_raw(&'x self, name: HeaderName<'_>) -> Option<Vec<Cow<'x, str>>>
sourcepub fn get_other_header(&'x self, name: &str) -> Option<Vec<Cow<'x, str>>>
pub fn get_other_header(&'x self, name: &str) -> Option<Vec<Cow<'x, str>>>
Returns in raw format a header field not defined in the conformed RFCs
sourcepub fn get_rfc_header(&'x self, name: RfcHeader) -> Option<Vec<Cow<'x, str>>>
pub fn get_rfc_header(&'x self, name: RfcHeader) -> Option<Vec<Cow<'x, str>>>
Returns in raw format a header field defined in the conformed RFCs
sourcepub fn get_html_body(&'x self, pos: usize) -> Option<Cow<'x, str>>
pub fn get_html_body(&'x self, pos: usize) -> Option<Cow<'x, str>>
Returns the transformed contents an inline HTML body part by position
sourcepub fn get_text_body(&'x self, pos: usize) -> Option<Cow<'x, str>>
pub fn get_text_body(&'x self, pos: usize) -> Option<Cow<'x, str>>
Returns the transformed contents an inline text body part by position
sourcepub fn get_html_part(&self, pos: usize) -> Option<&Part<'_, Cow<'x, str>>>
pub fn get_html_part(&self, pos: usize) -> Option<&Part<'_, Cow<'x, str>>>
Returns an inline HTML body part by position
sourcepub fn get_text_part(&self, pos: usize) -> Option<&Part<'_, Cow<'x, str>>>
pub fn get_text_part(&self, pos: usize) -> Option<&Part<'_, Cow<'x, str>>>
Returns an inline text body part by position
sourcepub fn get_attachment(&self, pos: usize) -> Option<&MessagePart<'x>>
pub fn get_attachment(&self, pos: usize) -> Option<&MessagePart<'x>>
Returns an attacment by position
sourcepub fn get_text_body_count(&self) -> usize
pub fn get_text_body_count(&self) -> usize
Returns the number of plain text body parts
sourcepub fn get_html_body_count(&self) -> usize
pub fn get_html_body_count(&self) -> usize
Returns the number of HTML body parts
sourcepub fn get_attachment_count(&self) -> usize
pub fn get_attachment_count(&self) -> usize
Returns the number of attachments
sourcepub fn get_text_bodies(&'x self) -> BodyPartIterator<'x>
pub fn get_text_bodies(&'x self) -> BodyPartIterator<'x>
Returns an Interator over the text body parts
sourcepub fn get_html_bodies(&'x self) -> BodyPartIterator<'x>
pub fn get_html_bodies(&'x self) -> BodyPartIterator<'x>
Returns an Interator over the HTML body parts
sourcepub fn get_attachments(&'x self) -> AttachmentIterator<'x>
pub fn get_attachments(&'x self) -> AttachmentIterator<'x>
Returns an Interator over the attachments
Trait Implementations
sourceimpl<'de: 'x, 'x> Deserialize<'de> for Message<'x>
impl<'de: 'x, 'x> Deserialize<'de> for Message<'x>
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'x> MimeHeaders<'x> for Message<'x>
impl<'x> MimeHeaders<'x> for Message<'x>
sourcefn get_content_description(&self) -> Option<&str>
fn get_content_description(&self) -> Option<&str>
Returns the Content-Description field
sourcefn get_content_disposition(&self) -> Option<&ContentType<'_>>
fn get_content_disposition(&self) -> Option<&ContentType<'_>>
Returns the Content-Disposition field
sourcefn get_content_id(&self) -> Option<&str>
fn get_content_id(&self) -> Option<&str>
Returns the Content-ID field
sourcefn get_content_transfer_encoding(&self) -> Option<&str>
fn get_content_transfer_encoding(&self) -> Option<&str>
Returns the Content-Encoding field
sourcefn get_content_type(&self) -> Option<&ContentType<'_>>
fn get_content_type(&self) -> Option<&ContentType<'_>>
Returns the Content-Type field
sourcefn get_content_language(&self) -> &HeaderValue<'x>
fn get_content_language(&self) -> &HeaderValue<'x>
Returns the Content-Language field
sourcefn get_content_location(&self) -> Option<&str>
fn get_content_location(&self) -> Option<&str>
Returns the Content-Location field
sourcefn get_attachment_name(&self) -> Option<&str>
fn get_attachment_name(&self) -> Option<&str>
Returns the attachment name, if any.
impl<'x> StructuralPartialEq for Message<'x>
Auto Trait Implementations
impl<'x> RefUnwindSafe for Message<'x>
impl<'x> Send for Message<'x>
impl<'x> Sync for Message<'x>
impl<'x> Unpin for Message<'x>
impl<'x> UnwindSafe for Message<'x>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more