pub struct Mail { /* private fields */ }Expand description
The mail handle. Cheap to clone: every clone is the same mail service.
Implementations§
Source§impl Mail
impl Mail
Sourcepub fn new(
mailer: Arc<dyn Mailer>,
sender: Sender,
templates: Templates,
queue: Queue,
available: Vec<MailDriverReg>,
db: Db,
) -> Self
pub fn new( mailer: Arc<dyn Mailer>, sender: Sender, templates: Templates, queue: Queue, available: Vec<MailDriverReg>, db: Db, ) -> Self
A mail service delivering through mailer as sender, rendering
from templates, queueing on queue. available lists the drivers
Mail::reconfigure may switch to.
Sourcepub fn from_config(
config: &MailConfig,
extra: impl IntoIterator<Item = MailDriverReg>,
templates: Templates,
queue: Queue,
db: Db,
) -> CoreResult<Self>
pub fn from_config( config: &MailConfig, extra: impl IntoIterator<Item = MailDriverReg>, templates: Templates, queue: Queue, db: Db, ) -> CoreResult<Self>
The service [mail] configures, over the built-in drivers and
extra.
Sourcepub fn reconfigure(&self, config: &MailConfig) -> CoreResult<()>
pub fn reconfigure(&self, config: &MailConfig) -> CoreResult<()>
Replaces the driver and sender, as a saved Mail settings model asks.
Sourcepub fn set_mailer(&self, mailer: Arc<dyn Mailer>)
pub fn set_mailer(&self, mailer: Arc<dyn Mailer>)
Swaps the driver alone (a test’s stub).
pub fn driver_name(&self) -> &'static str
Sourcepub fn driver_names(&self) -> Vec<&'static str>
pub fn driver_names(&self) -> Vec<&'static str>
The names of every driver this service can switch to, sorted.
pub fn sender(&self) -> Sender
Sourcepub async fn send(&self, message: Message) -> CoreResult<Pushed>
pub async fn send(&self, message: Message) -> CoreResult<Pushed>
Queues message: a worker renders and delivers it. With
queue.mode = inline it goes out here.
Sourcepub async fn send_now(&self, message: Message) -> CoreResult<()>
pub async fn send_now(&self, message: Message) -> CoreResult<()>
Renders and delivers message here, returning the driver’s error.
Sourcepub async fn envelope(&self, message: Message) -> CoreResult<Envelope>
pub async fn envelope(&self, message: Message) -> CoreResult<Envelope>
Renders message into what the driver would deliver, addresses
resolved; nothing is sent.
Sourcepub async fn send_test(&self, to: &str) -> CoreResult<()>
pub async fn send_test(&self, to: &str) -> CoreResult<()>
Sends the built-in test template to to here, returning the
driver’s error: what the Mail settings’ Send test does.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Mail
impl !UnwindSafe for Mail
impl Freeze for Mail
impl Send for Mail
impl Sync for Mail
impl Unpin for Mail
impl UnsafeUnpin for Mail
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,
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