Struct async_smtp::SmtpTransport
source · pub struct SmtpTransport { /* private fields */ }
Expand description
Structure that implements the high level SMTP client
Implementations§
source§impl<'a> SmtpTransport
impl<'a> SmtpTransport
sourcepub fn new(builder: SmtpClient) -> SmtpTransport
pub fn new(builder: SmtpClient) -> SmtpTransport
Creates a new SMTP client
It does not connect to the server, but only creates the SmtpTransport
sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Returns true if there is currently an established connection.
sourcepub async fn connect(&mut self) -> Result<(), Error>
pub async fn connect(&mut self) -> Result<(), Error>
Try to connect with the configured connection type, if not already connected.
sourcepub async fn command<C: Display>(&mut self, command: C) -> SmtpResult
pub async fn command<C: Display>(&mut self, command: C) -> SmtpResult
Send the given SMTP command to the server.
sourcepub async fn close(&mut self) -> Result<(), Error>
pub async fn close(&mut self) -> Result<(), Error>
Reset the client state and close the connection.
sourcepub async fn connect_and_send(&mut self, email: SendableEmail) -> SmtpResult
pub async fn connect_and_send(&mut self, email: SendableEmail) -> SmtpResult
Try to connect and then send a message.
Trait Implementations§
source§impl<'a> Transport<'a> for SmtpTransport
impl<'a> Transport<'a> for SmtpTransport
source§fn send<'life0, 'async_trait>(
&'life0 mut self,
email: SendableEmail
) -> Pin<Box<dyn Future<Output = SmtpResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 mut self,
email: SendableEmail
) -> Pin<Box<dyn Future<Output = SmtpResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sends an email