Struct mail_core::compose::BodyPart

source ·
pub struct BodyPart {
    pub resource: Resource,
    pub inline_embeddings: Vec<Resource>,
    pub attachments: Vec<Resource>,
}
Expand description

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.

Implementations

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.