pub struct Mailer { /* private fields */ }Expand description
A configured, ready-to-use sender.
Built once at boot and shared by every worker: the HTTP client pools its
connections and the SMTP transport pools its sessions, so a per-request
Mailer would be strictly worse and is not offered.
Implementations§
Source§impl Mailer
impl Mailer
Sourcepub fn from_config(config: &EmailConfig) -> Result<Option<Mailer>, EmailError>
pub fn from_config(config: &EmailConfig) -> Result<Option<Mailer>, EmailError>
Build the sender an app’s [email] section describes.
Ok(None) means the app doesn’t send mail (provider = "none", the
default) — not an error, just nothing to build. Err means it asked
for a provider and the request can’t be honoured, which is worth failing
the boot over: the alternative is discovering it at the first send.
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