pub struct MimePart<'x> {
pub headers: Vec<(Cow<'x, str>, HeaderType<'x>)>,
pub contents: BodyPart<'x>,
}
Expand description
MIME part of an e-mail.
Fields§
§headers: Vec<(Cow<'x, str>, HeaderType<'x>)>
§contents: BodyPart<'x>
Implementations§
Source§impl<'x> MimePart<'x>
impl<'x> MimePart<'x>
Sourcepub fn new(
content_type: impl Into<ContentType<'x>>,
contents: impl Into<BodyPart<'x>>,
) -> Self
pub fn new( content_type: impl Into<ContentType<'x>>, contents: impl Into<BodyPart<'x>>, ) -> Self
Create a new MIME part.
Sourcepub fn raw(contents: impl Into<BodyPart<'x>>) -> Self
pub fn raw(contents: impl Into<BodyPart<'x>>) -> Self
Create a new raw MIME part that includes both headers and body.
Sourcepub fn attachment(self, filename: impl Into<Cow<'x, str>>) -> Self
pub fn attachment(self, filename: impl Into<Cow<'x, str>>) -> Self
Set the attachment filename of a MIME part.
Sourcepub fn language(self, value: impl Into<Cow<'x, str>>) -> Self
pub fn language(self, value: impl Into<Cow<'x, str>>) -> Self
Set the Content-Language header of a MIME part.
Sourcepub fn cid(self, value: impl Into<Cow<'x, str>>) -> Self
pub fn cid(self, value: impl Into<Cow<'x, str>>) -> Self
Set the Content-ID header of a MIME part.
Sourcepub fn location(self, value: impl Into<Cow<'x, str>>) -> Self
pub fn location(self, value: impl Into<Cow<'x, str>>) -> Self
Set the Content-Location header of a MIME part.
Sourcepub fn transfer_encoding(self, value: impl Into<Cow<'x, str>>) -> Self
pub fn transfer_encoding(self, value: impl Into<Cow<'x, str>>) -> Self
Disable automatic Content-Transfer-Encoding detection and treat this as a raw MIME part
Sourcepub fn header(
self,
header: impl Into<Cow<'x, str>>,
value: impl Into<HeaderType<'x>>,
) -> Self
pub fn header( self, header: impl Into<Cow<'x, str>>, value: impl Into<HeaderType<'x>>, ) -> Self
Set custom headers of a MIME part.
Sourcepub fn write_part(self, output: impl Write) -> Result<usize>
pub fn write_part(self, output: impl Write) -> Result<usize>
Write the MIME part to a writer.
Trait Implementations§
Auto Trait Implementations§
impl<'x> Freeze for MimePart<'x>
impl<'x> RefUnwindSafe for MimePart<'x>
impl<'x> Send for MimePart<'x>
impl<'x> Sync for MimePart<'x>
impl<'x> Unpin for MimePart<'x>
impl<'x> UnwindSafe for MimePart<'x>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more