pub struct Email { /* private fields */ }mail only.Expand description
A thin wrapper around lettre::message::MessageBuilder for the
ergonomic email construction API.
Implementations§
Source§impl Email
impl Email
Sourcepub fn from_builder(builder: MessageBuilder) -> Self
pub fn from_builder(builder: MessageBuilder) -> Self
Construct an Email from an existing MessageBuilder (escape hatch).
Sourcepub fn plain(self, body: impl Into<String>) -> Result<Message, EmailError>
pub fn plain(self, body: impl Into<String>) -> Result<Message, EmailError>
Terminate the builder with a plain-text body.
§Errors
Returns EmailError::Build if lettre cannot build the message.
Sourcepub fn html(self, body: impl Into<String>) -> Result<Message, EmailError>
pub fn html(self, body: impl Into<String>) -> Result<Message, EmailError>
Terminate the builder with an HTML body.
§Errors
Returns EmailError::Build if lettre cannot build the message.
Sourcepub fn alternative(
self,
plain: impl Into<String>,
html: impl Into<String>,
) -> Result<Message, EmailError>
pub fn alternative( self, plain: impl Into<String>, html: impl Into<String>, ) -> Result<Message, EmailError>
Terminate the builder with an alternative plain/HTML body (the client picks whichever it can render).
§Errors
Returns EmailError::Build if lettre cannot build the message.
Sourcepub fn mixed(
self,
body: MultiPart,
attachments: Vec<EmailAttachment>,
) -> Result<Message, EmailError>
pub fn mixed( self, body: MultiPart, attachments: Vec<EmailAttachment>, ) -> Result<Message, EmailError>
Terminate the builder with a multipart/mixed body (a multipart body
plus attachments).
§Errors
Returns EmailError::Build if lettre cannot build the message.
Sourcepub fn plain_with_attachments(
self,
body: impl Into<String>,
attachments: Vec<EmailAttachment>,
) -> Result<Message, EmailError>
pub fn plain_with_attachments( self, body: impl Into<String>, attachments: Vec<EmailAttachment>, ) -> Result<Message, EmailError>
Terminate the builder with a plain body plus attachments.
§Errors
Returns EmailError::Build if lettre cannot build the message, or
EmailError::ContentType if an attachment content type is invalid.
Sourcepub fn alternative_with_attachments(
self,
plain: impl Into<String>,
html: impl Into<String>,
attachments: Vec<EmailAttachment>,
) -> Result<Message, EmailError>
pub fn alternative_with_attachments( self, plain: impl Into<String>, html: impl Into<String>, attachments: Vec<EmailAttachment>, ) -> Result<Message, EmailError>
Terminate the builder with an alternative plain/HTML body plus attachments.
§Errors
Returns EmailError::Build if lettre cannot build the message.
Sourcepub fn into_builder(self) -> MessageBuilder
pub fn into_builder(self) -> MessageBuilder
Consume the wrapper and return the underlying MessageBuilder (escape
hatch).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Email
impl RefUnwindSafe for Email
impl Send for Email
impl Sync for Email
impl Unpin for Email
impl UnsafeUnpin for Email
impl UnwindSafe for Email
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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