pub struct MessageBuilder<'x> {
    pub headers: Vec<(Cow<'x, str>, HeaderType<'x>)>,
    pub html_body: Option<MimePart<'x>>,
    pub text_body: Option<MimePart<'x>>,
    pub attachments: Option<Vec<MimePart<'x>>>,
    pub body: Option<MimePart<'x>>,
}
Expand description

Builds an RFC5322 compliant MIME email message.

Fields§

§headers: Vec<(Cow<'x, str>, HeaderType<'x>)>§html_body: Option<MimePart<'x>>§text_body: Option<MimePart<'x>>§attachments: Option<Vec<MimePart<'x>>>§body: Option<MimePart<'x>>

Implementations§

Create a new MessageBuilder.

Set the Message-ID header. If no Message-ID header is set, one will be generated automatically.

Set the In-Reply-To header.

Set the References header.

Set the Sender header.

Set the From header.

Set the To header.

Set the Cc header.

Set the Bcc header.

Set the Reply-To header.

Set the Subject header.

Set the Date header. If no Date header is set, one will be generated automatically.

Add a custom header.

Set custom headers.

Set the plain text body of the message. Note that only one plain text body per message can be set using this function. To build more complex MIME body structures, use the body method instead.

Set the HTML body of the message. Note that only one HTML body per message can be set using this function. To build more complex MIME body structures, use the body method instead.

Add a binary attachment to the message.

Add a text attachment to the message.

Add an inline binary to the message.

Set a custom MIME body structure.

Build the message.

Write the message body without headers.

Build message to a Vec.

Build message to a String.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. 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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.