pub struct MessageBuilder { /* private fields */ }Expand description
A builder for messages
Implementations§
Source§impl 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 behavior.
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§
Source§impl Clone for MessageBuilder
impl Clone for MessageBuilder
Source§fn clone(&self) -> MessageBuilder
fn clone(&self) -> MessageBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MessageBuilder
impl Debug for MessageBuilder
Auto Trait Implementations§
impl Freeze for MessageBuilder
impl RefUnwindSafe for MessageBuilder
impl Send for MessageBuilder
impl Sync for MessageBuilder
impl Unpin for MessageBuilder
impl UnwindSafe for MessageBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more