pub struct SmtpClient<T: AsyncRead + AsyncWrite> {
pub stream: T,
pub timeout: Duration,
}
Expand description
SMTP client builder
Fields§
§stream: T
§timeout: Duration
Implementations§
Source§impl<T: AsyncRead + AsyncWrite + Unpin> SmtpClient<T>
impl<T: AsyncRead + AsyncWrite + Unpin> SmtpClient<T>
pub async fn authenticate<U>( &mut self, credentials: impl AsRef<Credentials<U>>, capabilities: impl AsRef<EhloResponse<String>>, ) -> Result<&mut Self>
Source§impl<T: AsyncRead + AsyncWrite + Unpin> SmtpClient<T>
impl<T: AsyncRead + AsyncWrite + Unpin> SmtpClient<T>
pub async fn capabilities( &mut self, local_host: &str, is_lmtp: bool, ) -> Result<EhloResponse<String>>
Source§impl<T: AsyncRead + AsyncWrite + Unpin> SmtpClient<T>
impl<T: AsyncRead + AsyncWrite + Unpin> SmtpClient<T>
Source§impl SmtpClient<TcpStream>
impl SmtpClient<TcpStream>
Sourcepub async fn connect(remote_addr: SocketAddr, timeout: Duration) -> Result<Self>
pub async fn connect(remote_addr: SocketAddr, timeout: Duration) -> Result<Self>
Connects to a remote host address
Sourcepub async fn connect_using(
local_ip: IpAddr,
remote_addr: SocketAddr,
timeout: Duration,
) -> Result<Self>
pub async fn connect_using( local_ip: IpAddr, remote_addr: SocketAddr, timeout: Duration, ) -> Result<Self>
Connects to a remote host address using the provided local IP
Source§impl<T: AsyncRead + AsyncWrite + Unpin> SmtpClient<T>
impl<T: AsyncRead + AsyncWrite + Unpin> SmtpClient<T>
Sourcepub async fn ehlo(&mut self, hostname: &str) -> Result<EhloResponse<String>>
pub async fn ehlo(&mut self, hostname: &str) -> Result<EhloResponse<String>>
Sends a EHLO command to the server.
Sourcepub async fn lhlo(&mut self, hostname: &str) -> Result<EhloResponse<String>>
pub async fn lhlo(&mut self, hostname: &str) -> Result<EhloResponse<String>>
Sends a LHLO command to the server.
pub async fn read_ehlo(&mut self) -> Result<EhloResponse<String>>
Source§impl<T: AsyncRead + AsyncWrite + Unpin> SmtpClient<T>
impl<T: AsyncRead + AsyncWrite + Unpin> SmtpClient<T>
Sourcepub async fn mail_from(
&mut self,
addr: &str,
params: &Parameters<'_>,
) -> Result<()>
pub async fn mail_from( &mut self, addr: &str, params: &Parameters<'_>, ) -> Result<()>
Sends a MAIL FROM command to the server.
Sourcepub async fn rcpt_to(
&mut self,
addr: &str,
params: &Parameters<'_>,
) -> Result<()>
pub async fn rcpt_to( &mut self, addr: &str, params: &Parameters<'_>, ) -> Result<()>
Sends a RCPT TO command to the server.
Sourcepub async fn data(&mut self, message: impl AsRef<[u8]>) -> Result<()>
pub async fn data(&mut self, message: impl AsRef<[u8]>) -> Result<()>
Sends a DATA command to the server.
Source§impl<T: AsyncRead + AsyncWrite + Unpin> SmtpClient<T>
impl<T: AsyncRead + AsyncWrite + Unpin> SmtpClient<T>
Sourcepub async fn send<'x>(&mut self, message: impl IntoMessage<'x>) -> Result<()>
pub async fn send<'x>(&mut self, message: impl IntoMessage<'x>) -> Result<()>
Sends a message to the server.
Sourcepub async fn send_signed<'x, V: SigningKey>(
&mut self,
message: impl IntoMessage<'x>,
signer: &DkimSigner<V, Done>,
) -> Result<()>
pub async fn send_signed<'x, V: SigningKey>( &mut self, message: impl IntoMessage<'x>, signer: &DkimSigner<V, Done>, ) -> Result<()>
Sends a message to the server.
pub async fn write_message(&mut self, message: &[u8]) -> Result<()>
Source§impl SmtpClient<TcpStream>
impl SmtpClient<TcpStream>
Sourcepub async fn start_tls(
self,
tls_connector: &TlsConnector,
hostname: &str,
) -> Result<SmtpClient<TlsStream<TcpStream>>>
pub async fn start_tls( self, tls_connector: &TlsConnector, hostname: &str, ) -> Result<SmtpClient<TlsStream<TcpStream>>>
Upgrade the connection to TLS.
pub async fn into_tls( self, tls_connector: &TlsConnector, hostname: &str, ) -> Result<SmtpClient<TlsStream<TcpStream>>>
Source§impl SmtpClient<TlsStream<TcpStream>>
impl SmtpClient<TlsStream<TcpStream>>
pub fn tls_connection(&self) -> &ClientConnection
Auto Trait Implementations§
impl<T> Freeze for SmtpClient<T>where
T: Freeze,
impl<T> RefUnwindSafe for SmtpClient<T>where
T: RefUnwindSafe,
impl<T> Send for SmtpClient<T>where
T: Send,
impl<T> Sync for SmtpClient<T>where
T: Sync,
impl<T> Unpin for SmtpClient<T>where
T: Unpin,
impl<T> UnwindSafe for SmtpClient<T>where
T: UnwindSafe,
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