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 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 Freeze for SmtpConnection
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