logo
pub struct MessageBuilder { /* private fields */ }
Available on crate feature builder only.
Expand description

A builder for messages

Implementations

Creates a new default message builder

Set custom header to message

Add mailbox to header

Add Date header to message

Shortcut for self.header(header::Date::new(st)).

Set Date header using current date/time

Shortcut for self.date(SystemTime::now()), it is automatically inserted if no date has been provided.

Set Subject header to message

Shortcut for self.header(header::Subject(subject.into())).

Set Sender header. Should be used when providing several From mailboxes.

Defined in RFC5322.

Shortcut for self.header(header::Sender(mbox)).

Set or add mailbox to From header

Defined in RFC5322.

Shortcut for self.mailbox(header::From(mbox)).

Set or add mailbox to ReplyTo header

Defined in RFC5322.

Shortcut for self.mailbox(header::ReplyTo(mbox)).

Set or add mailbox to To header

Shortcut for self.mailbox(header::To(mbox)).

Set or add mailbox to Cc header

Shortcut for self.mailbox(header::Cc(mbox)).

Set or add mailbox to Bcc header

Shortcut for self.mailbox(header::Bcc(mbox)).

Set or add message id to In-Reply-To header

Set or add message id to References header

Set Message-ID header

Should generally be inserted by the mail relay.

If None is provided, an id will be generated in the <UUID@HOSTNAME>.

Force specific envelope (by default it is derived from headers)

Create Message using a Vec<u8>, String, or Body body

Automatically gets encoded with 7bit, quoted-printable or base64 Content-Transfer-Encoding, based on the most efficient and valid encoding for body.

Create message using mime body (MultiPart)

Create message using mime body (SinglePart)

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.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

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

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more