Struct async_smtp::SmtpTransport
source · 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>
impl<S: BufRead + Write + Unpin> SmtpTransport<S>
sourcepub async fn new(builder: SmtpClient, stream: S) -> Result<Self, Error>
pub async fn new(builder: SmtpClient, stream: S) -> Result<Self, Error>
Creates a new SMTP transport and connects.
sourcepub async fn try_login(
&mut self,
credentials: &Credentials,
accepted_mechanisms: &[Mechanism]
) -> Result<(), Error>
pub async fn try_login( &mut self, credentials: &Credentials, accepted_mechanisms: &[Mechanism] ) -> Result<(), Error>
Try to login with the given accepted mechanisms.
sourcepub async fn starttls(self) -> Result<S, Error>
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.
sourcepub async fn auth(
&mut self,
mechanism: Mechanism,
credentials: &Credentials
) -> SmtpResult
pub async fn auth( &mut self, mechanism: Mechanism, credentials: &Credentials ) -> SmtpResult
Sends an AUTH command with the given mechanism, and handles challenge if needed
sourcepub async fn send(&mut self, email: SendableEmail) -> SmtpResult
pub async fn send(&mut self, email: SendableEmail) -> SmtpResult
Sends an email.
Trait Implementations§
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> 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