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