pub struct SmtpMailer { /* private fields */ }
Expand description
An SMTP mailer client, implementing the async_mailer_core::Mailer
and async_mailer_core::DynMailer
traits
to be used as generic mailer or runtime-pluggable trait object.
An abstraction over mail-send
, sending mail via an SMTP connection.
Self-signed certificates can optionally be accepted, to use the SMTP mailer in development while using the Outlook mailer in production.
Implementations§
Source§impl SmtpMailer
impl SmtpMailer
Sourcepub fn new(
host: String,
port: u16,
invalid_certs: SmtpInvalidCertsPolicy,
user: String,
password: SecretBox<str>,
) -> SmtpMailer
pub fn new( host: String, port: u16, invalid_certs: SmtpInvalidCertsPolicy, user: String, password: SecretBox<str>, ) -> SmtpMailer
Create a new SMTP mailer client.
Trait Implementations§
Source§impl Clone for SmtpMailer
impl Clone for SmtpMailer
Source§fn clone(&self) -> SmtpMailer
fn clone(&self) -> SmtpMailer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SmtpMailer
impl Debug for SmtpMailer
Source§impl DynMailer for SmtpMailer
impl DynMailer for SmtpMailer
Source§fn send_mail<'life0, 'life1, 'async_trait>(
&'life0 self,
message: Message<'life1>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Sync + Send>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
SmtpMailer: 'async_trait,
fn send_mail<'life0, 'life1, 'async_trait>(
&'life0 self,
message: Message<'life1>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Sync + Send>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
SmtpMailer: 'async_trait,
Send the prepared MIME message via an SMTP connection, using the previously configured credentials.
§Errors
Returns a boxed, type-erased SmtpMailerError::Connect
error if a connection to the SMTP server cannot be established.
Returns a boxed, type-erased SmtpMailerError::Send
error if the connection was established but sending the e-mail message failed.
Source§impl Mailer for SmtpMailer
impl Mailer for SmtpMailer
Source§fn send_mail<'life0, 'life1, 'async_trait>(
&'life0 self,
message: Message<'life1>,
) -> Pin<Box<dyn Future<Output = Result<(), <SmtpMailer as Mailer>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
SmtpMailer: 'async_trait,
fn send_mail<'life0, 'life1, 'async_trait>(
&'life0 self,
message: Message<'life1>,
) -> Pin<Box<dyn Future<Output = Result<(), <SmtpMailer as Mailer>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
SmtpMailer: 'async_trait,
Send the prepared MIME message via an SMTP connection, using the previously configured credentials.
§Errors
Returns an SmtpMailerError::Connect
error if a connection to the SMTP server cannot be established.
Returns an SmtpMailerError::Send
error if the connection was established but sending the e-mail message failed.