[][src]Struct mail::compose::BodyPart

pub struct BodyPart {
    pub resource: Resource,
    pub inline_embeddings: Vec<Resource>,
    pub attachments: Vec<Resource>,
}

Parts used to create a mail body (in a multipart mail).

This type contains a Resource which is normally used to create a alternative body in a multipart/alternative section. As well as a number of "embeddings" which depending on there disposition can are either used as attachments or embedded resource to which the body can referre to by it's content id.

Fields

resource: Resource

A body created by a template.

inline_embeddings: Vec<Resource>

A number of embeddings which should be displayed inline.

This is normally used to embed images then displayed in a html body. It is not in the scope of this part of the library to bind content id's to resources to thinks using them to display the embeddings. This part of the library does "just" handle that they are correctly placed in the resulting Mail. The mail-templates crate provides more functionality for better ergonomics.

Note that embeddings placed in a BodyPart instance are potentially only usable in the body specified in the same BodyPart instance.

attachments: Vec<Resource>

A number of embeddings which should be treated as attachments.

Attachments of a BodyPart instance will be combined with the attachments of other instances and the ones in the MailParts instance.

Methods

impl BodyPart[src]

pub fn create_mail(self, attachments_out: &mut Vec<Mail>) -> Mail[src]

Creates a Mail instance from this BodyPart instance.

All embeddings in BodyPart.embeddings which have a attachment content disposition are placed into the attachments_out parameter, as attachments should always be handled on the outer most level but the produced mail is likely not the outer most level.

This will create a non-multipart body for the body Resource, if there are any embeddings which have a Inline disposition that body will be wrapped into a multipart/related body containing them.

Trait Implementations

impl Debug for BodyPart[src]

Auto Trait Implementations

impl Send for BodyPart

impl Sync for BodyPart

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<F, T> HeaderTryInto for F where
    T: HeaderTryFrom<F>, 
[src]

impl<T> HeaderTryFrom for T[src]

impl<T> Erased for T