Struct mail_send::SmtpClient
source · pub struct SmtpClient<T: AsyncRead + AsyncWrite> {
pub stream: T,
pub timeout: Duration,
}Expand description
SMTP client builder
Fields§
§stream: T§timeout: DurationImplementations§
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>where
U: AsRef<str> + PartialEq + Eq + Hash,
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 EHLO 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.