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: ResourceA 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§
Source§impl BodyPart
impl BodyPart
Sourcepub fn create_mail(self, attachments_out: &mut Vec<Mail>) -> Mail
pub fn create_mail(self, attachments_out: &mut Vec<Mail>) -> Mail
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.