Struct lettre::AsyncSmtpTransport
source · [−]pub struct AsyncSmtpTransport<E: Executor> { /* private fields */ }
tokio1
or async-std1
only.Expand description
Asynchronously sends emails using the SMTP protocol
Implementations
sourceimpl<E> AsyncSmtpTransport<E> where
E: Executor,
impl<E> AsyncSmtpTransport<E> where
E: Executor,
sourcepub fn relay(relay: &str) -> Result<AsyncSmtpTransportBuilder, Error>
Available on crate feature smtp-transport
and (crate features tokio1-native-tls
or tokio1-rustls-tls
or async-std1-rustls-tls
) only.
pub fn relay(relay: &str) -> Result<AsyncSmtpTransportBuilder, Error>
smtp-transport
and (crate features tokio1-native-tls
or tokio1-rustls-tls
or async-std1-rustls-tls
) only.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<AsyncSmtpTransportBuilder, Error>
Available on crate feature smtp-transport
and (crate features tokio1-native-tls
or tokio1-rustls-tls
or async-std1-rustls-tls
) only.
pub fn starttls_relay(relay: &str) -> Result<AsyncSmtpTransportBuilder, Error>
smtp-transport
and (crate features tokio1-native-tls
or tokio1-rustls-tls
or async-std1-rustls-tls
) only.Simple an secure transport, using STARTTLS to obtain encrypted connections
Alternative to AsyncSmtpTransport::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() -> AsyncSmtpTransport<E>
Available on crate feature smtp-transport
only.
pub fn unencrypted_localhost() -> AsyncSmtpTransport<E>
smtp-transport
only.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
) -> AsyncSmtpTransportBuilder
Available on crate feature smtp-transport
only.
pub fn builder_dangerous<T: Into<String>>(
server: T
) -> AsyncSmtpTransportBuilder
smtp-transport
only.Creates a new SMTP client
Defaults are:
- No authentication
- No TLS
- A 60 seconds timeout for smtp commands
- Port 25
Consider using AsyncSmtpTransport::relay
or
AsyncSmtpTransport::starttls_relay
instead,
if possible.
sourcepub async fn test_connection(&self) -> Result<bool, Error>
Available on crate feature smtp-transport
only.
pub async fn test_connection(&self) -> Result<bool, Error>
smtp-transport
only.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
sourceimpl AsyncTransport for AsyncSmtpTransport<Tokio1Executor>
Available on crate feature smtp-transport
only.
impl AsyncTransport for AsyncSmtpTransport<Tokio1Executor>
smtp-transport
only.sourcefn send_raw<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
envelope: &'life1 Envelope,
email: &'life2 [u8]
) -> Pin<Box<dyn Future<Output = Result<Self::Ok, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Available on crate features tokio1
or async-std1
only.
fn send_raw<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
envelope: &'life1 Envelope,
email: &'life2 [u8]
) -> Pin<Box<dyn Future<Output = Result<Self::Ok, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
tokio1
or async-std1
only.Sends an email
type Ok = Response
type Ok = Response
tokio1
or async-std1
only.Response produced by the Transport
type Error = Error
type Error = Error
tokio1
or async-std1
only.Error produced by the Transport
sourcefn send<'life0, 'async_trait>(
&'life0 self,
message: Message
) -> Pin<Box<dyn Future<Output = Result<Self::Ok, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
message: Message
) -> Pin<Box<dyn Future<Output = Result<Self::Ok, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
tokio1
or async-std1
) and crate feature builder
only.Sends the email
sourceimpl AsyncTransport for AsyncSmtpTransport<AsyncStd1Executor>
Available on crate feature smtp-transport
only.
impl AsyncTransport for AsyncSmtpTransport<AsyncStd1Executor>
smtp-transport
only.sourcefn send_raw<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
envelope: &'life1 Envelope,
email: &'life2 [u8]
) -> Pin<Box<dyn Future<Output = Result<Self::Ok, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Available on crate features tokio1
or async-std1
only.
fn send_raw<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
envelope: &'life1 Envelope,
email: &'life2 [u8]
) -> Pin<Box<dyn Future<Output = Result<Self::Ok, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
tokio1
or async-std1
only.Sends an email
type Ok = Response
type Ok = Response
tokio1
or async-std1
only.Response produced by the Transport
type Error = Error
type Error = Error
tokio1
or async-std1
only.Error produced by the Transport
sourcefn send<'life0, 'async_trait>(
&'life0 self,
message: Message
) -> Pin<Box<dyn Future<Output = Result<Self::Ok, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
message: Message
) -> Pin<Box<dyn Future<Output = Result<Self::Ok, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
tokio1
or async-std1
) and crate feature builder
only.Sends the email
sourceimpl<E> Clone for AsyncSmtpTransport<E> where
E: Executor,
Available on crate feature smtp-transport
only.
impl<E> Clone for AsyncSmtpTransport<E> where
E: Executor,
smtp-transport
only.Auto Trait Implementations
impl<E> !RefUnwindSafe for AsyncSmtpTransport<E>
impl<E> Send for AsyncSmtpTransport<E>
impl<E> Sync for AsyncSmtpTransport<E>
impl<E> Unpin for AsyncSmtpTransport<E>
impl<E> !UnwindSafe for AsyncSmtpTransport<E>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more