pub struct SmtpConnection { /* private fields */ }Expand description
SMTP client connection for outbound delivery
Implementations§
Source§impl SmtpConnection
impl SmtpConnection
Sourcepub async fn connect(host: &str, port: u16) -> Result<Self>
pub async fn connect(host: &str, port: u16) -> Result<Self>
connect to an SMTP server and read the greeting
Sourcepub async fn connect_with_timeout(
host: &str,
port: u16,
timeouts: &TimeoutConfig,
) -> Result<Self>
pub async fn connect_with_timeout( host: &str, port: u16, timeouts: &TimeoutConfig, ) -> Result<Self>
connect with explicit timeout configuration
Sourcepub async fn ehlo(&mut self, hostname: &str) -> Result<SmtpResponse>
pub async fn ehlo(&mut self, hostname: &str) -> Result<SmtpResponse>
send EHLO and return the response
Sourcepub async fn starttls(self, hostname: &str) -> Result<Self>
pub async fn starttls(self, hostname: &str) -> Result<Self>
Upgrade to TLS via STARTTLS — classic API returning the
upgraded connection or an opaque io::Error.
Internally delegates to Self::try_starttls. Callers that
want structured TLS-failure classification (for TLSRPT
reporting, metrics labels, etc.) should call try_starttls
directly.
Sourcepub async fn starttls_dane(
self,
hostname: &str,
tlsa_records: Vec<TlsaRecord>,
) -> Result<Self>
pub async fn starttls_dane( self, hostname: &str, tlsa_records: Vec<TlsaRecord>, ) -> Result<Self>
Upgrade to TLS via STARTTLS with DANE TLSA verification —
classic API. See Self::try_starttls_dane for the
structured variant.
Sourcepub async fn try_starttls(self, hostname: &str) -> StarttlsResult
pub async fn try_starttls(self, hostname: &str) -> StarttlsResult
Upgrade to TLS via STARTTLS, returning a structured
StarttlsResult that discriminates between server-side
rejection (connection still usable) and handshake failure
(connection unrecoverable, must reconnect). On handshake
failure, the wrapped TlsOutcome is RFC 8460 §4.3-aligned
so callers can build TLSRPT reports directly.
Sourcepub async fn try_starttls_dane(
self,
hostname: &str,
tlsa_records: Vec<TlsaRecord>,
) -> StarttlsResult
pub async fn try_starttls_dane( self, hostname: &str, tlsa_records: Vec<TlsaRecord>, ) -> StarttlsResult
Upgrade to TLS via STARTTLS with DANE TLSA verification,
returning a structured StarttlsResult. DANE-specific
certificate rejections are reported as
TlsOutcome::DaneValidationFailure rather than the PKIX
CertificateNotTrusted so TLSRPT reports can distinguish
tlsa-invalid from generic untrusted-CA failures.
Auto Trait Implementations§
impl !Freeze for SmtpConnection
impl !RefUnwindSafe for SmtpConnection
impl Send for SmtpConnection
impl Sync for SmtpConnection
impl Unpin for SmtpConnection
impl UnsafeUnpin 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more