[−][src]Struct mailparse::ParsedMail
Struct that holds the structured representation of the message. Note that since MIME allows for nested multipart messages, a tree-like structure is necessary to represent it properly. This struct accomplishes that by holding a vector of other ParsedMail structures for the subparts.
Fields
headers: Vec<MailHeader<'a>>
The headers for the message (or message subpart).
ctype: ParsedContentType
The Content-Type information for the message (or message subpart).
subparts: Vec<ParsedMail<'a>>
The subparts of this message or subpart. This vector is only non-empty if ctype.mimetype starts with "multipart/".
Methods
impl<'a> ParsedMail<'a>
[src]
pub fn get_body(&self) -> Result<String, MailParseError>
[src]
Get the body of the message as a Rust string. This function tries to unapply the Content-Transfer-Encoding if there is one, and then converts the result into a Rust UTF-8 string using the charset in the Content-Type (or "us-ascii" if the charset was missing or not recognized).
Examples
use mailparse::parse_mail; let p = parse_mail(concat!( "Subject: test\n", "\n", "This is the body").as_bytes()) .unwrap(); assert_eq!(p.get_body().unwrap(), "This is the body");
pub fn get_body_raw(&self) -> Result<Vec<u8>, MailParseError>
[src]
Get the body of the message as a Rust Vec
Examples
use mailparse::parse_mail; let p = parse_mail(concat!( "Subject: test\n", "\n", "This is the body").as_bytes()) .unwrap(); assert_eq!(p.get_body_raw().unwrap(), b"This is the body");
pub fn get_content_disposition(
&self
) -> Result<ParsedContentDisposition, MailParseError>
[src]
&self
) -> Result<ParsedContentDisposition, MailParseError>
Returns a struct containing a parsed representation of the
Content-Disposition header. The first header with this name
is used, if there are multiple. See the parse_content_disposition
method documentation for more details on the semantics of the
returned object.
Trait Implementations
Auto Trait Implementations
impl<'a> Send for ParsedMail<'a>
impl<'a> Sync for ParsedMail<'a>
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,