pub struct SmtpTransport { /* private fields */ }
Expand description
Sends emails using the SMTP protocol
Implementations§
Source§impl SmtpTransport
impl SmtpTransport
Sourcepub fn relay(relay: &str) -> Result<SmtpTransportBuilder, Error>
pub fn relay(relay: &str) -> Result<SmtpTransportBuilder, Error>
Simple and secure transport, using TLS connections to communicate with the SMTP server
The right option for most SMTP servers.
Creates an encrypted transport over submissions port, using the provided domain to validate TLS certificates.
Sourcepub fn starttls_relay(relay: &str) -> Result<SmtpTransportBuilder, Error>
pub fn starttls_relay(relay: &str) -> Result<SmtpTransportBuilder, Error>
Simple an secure transport, using STARTTLS to obtain encrypted connections
Alternative to SmtpTransport::relay
, for SMTP servers
that don’t take SMTPS connections.
Creates an encrypted transport over submissions port, by first connecting using an unencrypted connection and then upgrading it with STARTTLS. The provided domain is used to validate TLS certificates.
An error is returned if the connection can’t be upgraded. No credentials or emails will be sent to the server, protecting from downgrade attacks.
Sourcepub fn unencrypted_localhost() -> SmtpTransport
pub fn unencrypted_localhost() -> SmtpTransport
Creates a new local SMTP client to port 25
Shortcut for local unencrypted relay (typical local email daemon that will handle relaying)
Sourcepub fn builder_dangerous<T: Into<String>>(server: T) -> SmtpTransportBuilder
pub fn builder_dangerous<T: Into<String>>(server: T) -> SmtpTransportBuilder
Creates a new SMTP client
Defaults are:
- No authentication
- No TLS
- A 60 seconds timeout for smtp commands
- Port 25
Consider using SmtpTransport::relay
or
SmtpTransport::starttls_relay
instead,
if possible.
Sourcepub fn test_connection(&self) -> Result<bool, Error>
pub fn test_connection(&self) -> Result<bool, Error>
Tests the SMTP connection
test_connection()
tests the connection by using the SMTP NOOP command.
The connection is closed afterwards if a connection pool is not used.
Trait Implementations§
Source§impl Clone for SmtpTransport
impl Clone for SmtpTransport
Source§fn clone(&self) -> SmtpTransport
fn clone(&self) -> SmtpTransport
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more