pub struct AsyncSmtpConnection { /* private fields */ }
Available on crate feature
smtp-transport
only.Expand description
Structure that implements the SMTP client
Implementations
sourceimpl AsyncSmtpConnection
impl AsyncSmtpConnection
pub fn server_info(&self) -> &ServerInfo
sourcepub async fn connect_tokio1<T: ToSocketAddrs>(
server: T,
timeout: Option<Duration>,
hello_name: &ClientId,
tls_parameters: Option<TlsParameters>
) -> Result<AsyncSmtpConnection, Error>
pub async fn connect_tokio1<T: ToSocketAddrs>(
server: T,
timeout: Option<Duration>,
hello_name: &ClientId,
tls_parameters: Option<TlsParameters>
) -> Result<AsyncSmtpConnection, Error>
Connects to the configured server
Sends EHLO and parses server information
sourcepub async fn connect_asyncstd1<T: ToSocketAddrs>(
server: T,
timeout: Option<Duration>,
hello_name: &ClientId,
tls_parameters: Option<TlsParameters>
) -> Result<AsyncSmtpConnection, Error>
pub async fn connect_asyncstd1<T: ToSocketAddrs>(
server: T,
timeout: Option<Duration>,
hello_name: &ClientId,
tls_parameters: Option<TlsParameters>
) -> Result<AsyncSmtpConnection, Error>
Connects to the configured server
Sends EHLO and parses server information
pub async fn send(
&mut self,
envelope: &Envelope,
email: &[u8]
) -> Result<Response, Error>
pub fn has_broken(&self) -> bool
pub fn can_starttls(&self) -> bool
pub async fn starttls(
&mut self,
tls_parameters: TlsParameters,
hello_name: &ClientId
) -> Result<(), Error>
pub async fn quit(&mut self) -> Result<Response, Error>
pub async fn abort(&mut self)
sourcepub fn set_stream(&mut self, stream: AsyncNetworkStream)
pub fn set_stream(&mut self, stream: AsyncNetworkStream)
Sets the underlying stream
sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
Tells if the underlying stream is currently encrypted
sourcepub async fn test_connected(&mut self) -> bool
pub async fn test_connected(&mut self) -> bool
Checks if the server is connected using the NOOP SMTP command
sourcepub async fn auth(
&mut self,
mechanisms: &[Mechanism],
credentials: &Credentials
) -> Result<Response, Error>
pub async fn auth(
&mut self,
mechanisms: &[Mechanism],
credentials: &Credentials
) -> Result<Response, Error>
Sends an AUTH command with the given mechanism, and handles challenge if needed
sourcepub async fn message(&mut self, message: &[u8]) -> Result<Response, Error>
pub async fn message(&mut self, message: &[u8]) -> Result<Response, Error>
Sends the message content
sourcepub async fn command<C: Display>(
&mut self,
command: C
) -> Result<Response, Error>
pub async fn command<C: Display>(
&mut self,
command: C
) -> Result<Response, Error>
Sends an SMTP command
sourcepub async fn read_response(&mut self) -> Result<Response, Error>
pub async fn read_response(&mut self) -> Result<Response, Error>
Gets the SMTP response
Auto Trait Implementations
impl !RefUnwindSafe for AsyncSmtpConnection
impl Send for AsyncSmtpConnection
impl Sync for AsyncSmtpConnection
impl Unpin for AsyncSmtpConnection
impl !UnwindSafe for AsyncSmtpConnection
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