Skip to main content

SmtpClientStd

Struct SmtpClientStd 

Source
pub struct SmtpClientStd {
    pub inner: SmtpClientStd,
    pub default_reverse_path: Option<String>,
}
Available on crate features client and smtp only.
Expand description

Light SMTP client built on a generic blocking stream.

default_reverse_path overrides the MAIL FROM envelope sender for accounts whose header From: differs from the SMTP sender (DKIM-aligned gateways, bounce-address rewriting).

Fields§

§inner: SmtpClientStd§default_reverse_path: Option<String>

Implementations§

Source§

impl SmtpClientStd

Source

pub fn new<S: Read + Write + Send + 'static>(stream: S) -> Self

Wraps an already-authenticated SMTP stream with no envelope override.

Source

pub fn run<C, T, E>(&mut self, coroutine: C) -> Result<T, SmtpClientError>
where C: SmtpCoroutine<Yield = SmtpYield, Return = Result<T, E>>, SmtpClientError: From<E>,

Pumps any standard-shape SMTP coroutine (Yield = SmtpYield, Return = Result<T, E>) against the inner client’s stream until it terminates.

Reaches into Self::inner for raw field access rather than delegating to InnerSmtpClientStd::run so error variants route through SmtpClientError directly.

Source

pub fn ping(&mut self) -> Result<(), SmtpClientError>

Sends a NOOP to keep the connection alive (RFC 5321 §4.1.1.9). Sole purpose is to reset the server’s inactivity timer on long-idle TUI sessions; the response is discarded.

Source

pub fn send_message(&mut self, raw: Vec<u8>) -> Result<(), SmtpClientError>

Sends the raw RFC 5322 raw message through the authenticated stream. Reverse path comes from Self::default_reverse_path when set, otherwise from the message’s From: header; forward paths come from To: + Cc: + Bcc:.

Source§

impl SmtpClientStd

Source

pub fn connect( url: &Url, tls: &Tls, starttls: bool, domain: EhloDomain<'_>, sasl: Option<impl Into<Sasl>>, ) -> Result<Self, SmtpClientError>

Available on crate features native-tls or rustls-aws or rustls-ring only.

Opens a TCP / TLS connection to url, runs the optional STARTTLS upgrade plus EHLO + SASL authentication, then wraps the authenticated stream with the io-email knobs (empty default_reverse_path).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

Source§

type Proj<U: 'src> = U

Source§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

Source§

impl<T, S> SpanWrap<S> for T
where S: WrappingSpan<T>,

Source§

fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned

Invokes WrappingSpan::make_wrapped to wrap an AST node in a span.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.