pub struct SmtpClient { /* private fields */ }Implementations§
Source§impl SmtpClient
impl SmtpClient
pub async fn new<A: ToSocketAddrs + ToString + Clone>( addr: A, timeouts: SmtpClientTimeouts, ) -> Result<Self>
pub fn with_stream<S: AsyncReadAndWrite + 'static, H: AsRef<str>>( stream: S, peer_hostname: H, timeouts: SmtpClientTimeouts, ) -> Self
Sourcepub fn set_ignore_8bit_checks(&mut self, enable: bool)
pub fn set_ignore_8bit_checks(&mut self, enable: bool)
Setting this to true causes 8BITMIME and SMTPUTF8 checks to be ignored
pub fn is_connected(&self) -> bool
pub fn set_enable_rset(&mut self, enable: bool)
pub fn set_enable_pipelining(&mut self, enable: bool)
pub fn set_tracer(&mut self, tracer: Arc<dyn SmtpClientTracer + Send + Sync>)
pub fn timeouts(&self) -> &SmtpClientTimeouts
Sourcepub async fn check_unilateral_response(
&mut self,
) -> Result<Option<Response>, ClientError>
pub async fn check_unilateral_response( &mut self, ) -> Result<Option<Response>, ClientError>
Check to see if there is either a unilateral response or an error condition immediately available on the socket.
Intended to be used after the connection has idled to see if the peer has opted to close the connection, either gracefully by sending what should be a 421, or abruptly by simply snipping the connection.
pub async fn read_response( &mut self, command: Option<&Command>, timeout_duration: Duration, ) -> Result<Response, ClientError>
pub async fn send_command( &mut self, command: &Command, ) -> Result<Response, ClientError>
Sourcepub async fn pipeline_commands(
&mut self,
commands: Vec<Command>,
) -> Vec<Result<Response, ClientError>>
pub async fn pipeline_commands( &mut self, commands: Vec<Command>, ) -> Vec<Result<Response, ClientError>>
Issue a series of commands, and return the responses to those commands.
If the server advertised the RFC 2920 PIPELINING extension, the commands are written one after the other before waiting to read any data, resulting in lower overall latency due to round-trip-times.
If PIPELINING is not available, each command is written and the response read before attempting to write the next command.
The number of returned responses may be smaller than the number of requested commands if there is an issue with the network connection.
pub async fn ehlo_lhlo( &mut self, ehlo_name: &str, use_lmtp: bool, ) -> Result<&HashMap<String, EsmtpCapability>, ClientError>
pub async fn lhlo( &mut self, ehlo_name: &str, ) -> Result<&HashMap<String, EsmtpCapability>, ClientError>
pub async fn ehlo( &mut self, ehlo_name: &str, ) -> Result<&HashMap<String, EsmtpCapability>, ClientError>
pub async fn auth_plain( &mut self, username: &str, password: Option<&str>, ) -> Result<(), ClientError>
Sourcepub async fn starttls(
&mut self,
options: TlsOptions,
) -> Result<TlsStatus, ClientError>
pub async fn starttls( &mut self, options: TlsOptions, ) -> Result<TlsStatus, ClientError>
Attempt TLS handshake. Returns Err for IO errors. On completion, return an option that will be:
- Some(handshake_error) - if the handshake failed
- None - if the handshake succeeded