pub struct SmtpConnection { /* private fields */ }
Expand description
Structure that implements the SMTP client
Implementations§
source§impl SmtpConnection
impl SmtpConnection
sourcepub fn server_info(&self) -> &ServerInfo
pub fn server_info(&self) -> &ServerInfo
Get information about the server
sourcepub fn connect<A: ToSocketAddrs>(
server: A,
timeout: Option<Duration>,
hello_name: &ClientId,
tls_parameters: Option<&TlsParameters>,
local_address: Option<IpAddr>
) -> Result<SmtpConnection, Error>
pub fn connect<A: ToSocketAddrs>( server: A, timeout: Option<Duration>, hello_name: &ClientId, tls_parameters: Option<&TlsParameters>, local_address: Option<IpAddr> ) -> 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 the 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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more