Struct lettre::message::MessageBuilder
source · [−]pub struct MessageBuilder { /* private fields */ }
builder
only.Expand description
A builder for messages
Implementations
sourceimpl MessageBuilder
impl MessageBuilder
sourcepub fn from(self, mbox: Mailbox) -> Self
pub fn from(self, mbox: Mailbox) -> Self
Set or add mailbox to From
header
Defined in RFC5322.
Shortcut for self.mailbox(header::From(mbox))
.
sourcepub fn sender(self, mbox: Mailbox) -> Self
pub fn sender(self, mbox: Mailbox) -> Self
Set Sender
header. Should be used when providing several From
mailboxes.
Defined in RFC5322.
Shortcut for self.header(header::Sender(mbox))
.
sourcepub fn date(self, st: SystemTime) -> Self
pub fn date(self, st: SystemTime) -> Self
Add Date
header to message
Shortcut for self.header(header::Date::new(st))
.
sourcepub fn date_now(self) -> Self
pub fn date_now(self) -> Self
Set Date
header using current date/time
Shortcut for self.date(SystemTime::now())
, it is automatically inserted
if no date has been provided.
sourcepub fn reply_to(self, mbox: Mailbox) -> Self
pub fn reply_to(self, mbox: Mailbox) -> Self
Set or add mailbox to ReplyTo
header
Defined in RFC5322.
Shortcut for self.mailbox(header::ReplyTo(mbox))
.
sourcepub fn to(self, mbox: Mailbox) -> Self
pub fn to(self, mbox: Mailbox) -> Self
Set or add mailbox to To
header
Shortcut for self.mailbox(header::To(mbox))
.
sourcepub fn cc(self, mbox: Mailbox) -> Self
pub fn cc(self, mbox: Mailbox) -> Self
Set or add mailbox to Cc
header
Shortcut for self.mailbox(header::Cc(mbox))
.
sourcepub fn bcc(self, mbox: Mailbox) -> Self
pub fn bcc(self, mbox: Mailbox) -> Self
Set or add mailbox to Bcc
header
Shortcut for self.mailbox(header::Bcc(mbox))
.
sourcepub fn in_reply_to(self, id: String) -> Self
pub fn in_reply_to(self, id: String) -> Self
Set or add message id to In-Reply-To
header
sourcepub fn references(self, id: String) -> Self
pub fn references(self, id: String) -> Self
Set or add message id to References
header
sourcepub fn subject<S: Into<String>>(self, subject: S) -> Self
pub fn subject<S: Into<String>>(self, subject: S) -> Self
Set Subject
header to message
Shortcut for self.header(header::Subject(subject.into()))
.
sourcepub fn message_id(self, id: Option<String>) -> Self
pub fn message_id(self, id: Option<String>) -> Self
Should generally be inserted by the mail relay.
If None
is provided, an id will be generated in the
<UUID@HOSTNAME>
.
sourcepub fn user_agent(self, id: String) -> Self
pub fn user_agent(self, id: String) -> Self
sourcepub fn mailbox<H: Header + MailboxesHeader>(self, header: H) -> Self
pub fn mailbox<H: Header + MailboxesHeader>(self, header: H) -> Self
Add mailbox to header
sourcepub fn envelope(self, envelope: Envelope) -> Self
pub fn envelope(self, envelope: Envelope) -> Self
Force specific envelope (by default it is derived from headers)
sourcepub fn keep_bcc(self) -> Self
pub fn keep_bcc(self) -> Self
Keep the Bcc
header
By default the Bcc
header is removed from the email after
using it to generate the message envelope. In some cases though,
like when saving the email as an .eml
, or sending through
some transports (like the Gmail API) that don’t take a separate
envelope value, it becomes necessary to keep the Bcc
header.
Calling this method overrides the default behaviour.
sourcepub fn multipart(self, part: MultiPart) -> Result<Message, EmailError>
pub fn multipart(self, part: MultiPart) -> Result<Message, EmailError>
Create message using mime body (MultiPart
)
sourcepub fn singlepart(self, part: SinglePart) -> Result<Message, EmailError>
pub fn singlepart(self, part: SinglePart) -> Result<Message, EmailError>
Create message using mime body (SinglePart
)
Trait Implementations
sourceimpl Clone for MessageBuilder
impl Clone for MessageBuilder
sourcefn clone(&self) -> MessageBuilder
fn clone(&self) -> MessageBuilder
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for MessageBuilder
impl Debug for MessageBuilder
Auto Trait Implementations
impl RefUnwindSafe for MessageBuilder
impl Send for MessageBuilder
impl Sync for MessageBuilder
impl Unpin for MessageBuilder
impl UnwindSafe for MessageBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more