pub struct SmtpTransport<S: BufRead + Write + Unpin> { /* private fields */ }
Expand description

Structure that implements the high level SMTP client

Implementations§

source§

impl<S: BufRead + Write + Unpin> SmtpTransport<S>

source

pub async fn new(builder: SmtpClient, stream: S) -> Result<Self, Error>

Creates a new SMTP transport and connects.

source

pub async fn try_login( &mut self, credentials: &Credentials, accepted_mechanisms: &[Mechanism] ) -> Result<(), Error>

Try to login with the given accepted mechanisms.

source

pub async fn starttls(self) -> Result<S, Error>

Sends STARTTLS command if the server supports it.

Returns inner stream which should be upgraded to TLS.

source

pub async fn quit(&mut self) -> Result<(), Error>

Closes the SMTP transaction if possible.

source

pub async fn auth( &mut self, mechanism: Mechanism, credentials: &Credentials ) -> SmtpResult

Sends an AUTH command with the given mechanism, and handles challenge if needed

source

pub async fn send(&mut self, email: SendableEmail) -> SmtpResult

Sends an email.

Trait Implementations§

source§

impl<S: Debug + BufRead + Write + Unpin> Debug for SmtpTransport<S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> Freeze for SmtpTransport<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for SmtpTransport<S>
where S: RefUnwindSafe,

§

impl<S> Send for SmtpTransport<S>
where S: Send,

§

impl<S> Sync for SmtpTransport<S>
where S: Sync,

§

impl<S> Unpin for SmtpTransport<S>

§

impl<S> UnwindSafe for SmtpTransport<S>
where S: UnwindSafe,

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<T, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.