Struct rfc5321::client::SmtpClient
source · 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
pub fn set_tracer(&mut self, tracer: Arc<dyn SmtpClientTracer + Send + Sync>)
pub fn timeouts(&self) -> &SmtpClientTimeouts
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( &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
pub async fn send_mail<B: AsRef<[u8]>, SENDER: Into<ReversePath>, RECIP: Into<ForwardPath>>( &mut self, sender: SENDER, recipient: RECIP, data: B, ) -> Result<Response, ClientError>
Trait Implementations§
source§impl Debug for SmtpClient
impl Debug for SmtpClient
Auto Trait Implementations§
impl Freeze for SmtpClient
impl !RefUnwindSafe for SmtpClient
impl Send for SmtpClient
impl !Sync for SmtpClient
impl Unpin for SmtpClient
impl !UnwindSafe for SmtpClient
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