pub enum Mailer {
Smtp {
transport: AsyncSmtpTransport<Tokio1Executor>,
default_from: String,
},
Capture(Arc<Mutex<Vec<OutgoingEmail>>>, String),
}Expand description
Delivery mechanism. Cloneable so it can live in AppState.
Variants§
Implementations§
Source§impl Mailer
impl Mailer
Sourcepub fn capture(from: impl Into<String>) -> Self
pub fn capture(from: impl Into<String>) -> Self
Capture mailer with the given From: and an empty store.
Clones share the underlying store.
Sourcepub fn from_config(config: &Config) -> Result<Self, MailError>
pub fn from_config(config: &Config) -> Result<Self, MailError>
SMTP when [smtp] is present, otherwise capture for dev/test.
Sourcepub async fn send(&self, email: OutgoingEmail) -> Result<(), MailError>
pub async fn send(&self, email: OutgoingEmail) -> Result<(), MailError>
Deliver an already-rendered email.
Capture pushes synchronously; SMTP awaits delivery. Callers that must not block (HTTP handlers) should spawn.
Sourcepub fn all(&self) -> Vec<OutgoingEmail>
pub fn all(&self) -> Vec<OutgoingEmail>
All captured emails in insertion order.
Sourcepub fn get(&self, idx: usize) -> Option<OutgoingEmail>
pub fn get(&self, idx: usize) -> Option<OutgoingEmail>
Get a single captured email by index.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Mailer
impl !UnwindSafe for Mailer
impl Freeze for Mailer
impl Send for Mailer
impl Sync for Mailer
impl Unpin for Mailer
impl UnsafeUnpin for Mailer
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
Mutably borrows from an owned value. Read more
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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