From a0224af701db5c7ddb03d4775f34cc4efb65909d Mon Sep 17 00:00:00 2001 From: bold Date: Fri, 12 Jun 2020 08:54:41 +0800 Subject: [PATCH 1/2] Connect and send in examples --- examples/smtp.rs | 2 +- examples/smtp_gmail.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/smtp.rs b/examples/smtp.rs index 8523463..b834f84 100644 --- a/examples/smtp.rs +++ b/examples/smtp.rs @@ -19,7 +19,7 @@ fn main() { .unwrap() .into_transport(); // Send the email - let result = mailer.send(email).await; + let result = mailer.connect_and_send(email).await; if result.is_ok() { println!("Email sent"); diff --git a/examples/smtp_gmail.rs b/examples/smtp_gmail.rs index a7b32cb..a1828b0 100644 --- a/examples/smtp_gmail.rs +++ b/examples/smtp_gmail.rs @@ -26,7 +26,7 @@ fn main() { .into_transport(); // Send the email - let result = mailer.send(email).await; + let result = mailer.connect_and_send(email).await; if result.is_ok() { println!("Email sent"); From 2efd35fce1adf183a2b7bca85e590f5397d19a4b Mon Sep 17 00:00:00 2001 From: bold Date: Fri, 12 Jun 2020 09:00:49 +0800 Subject: [PATCH 2/2] Remove some warnings --- examples/smtp.rs | 2 +- examples/smtp_gmail.rs | 2 +- src/smtp/smtp_client.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/smtp.rs b/examples/smtp.rs index b834f84..39e64e3 100644 --- a/examples/smtp.rs +++ b/examples/smtp.rs @@ -1,4 +1,4 @@ -use async_smtp::{EmailAddress, Envelope, SendableEmail, SmtpClient, Transport}; +use async_smtp::{EmailAddress, Envelope, SendableEmail, SmtpClient}; fn main() { env_logger::init(); diff --git a/examples/smtp_gmail.rs b/examples/smtp_gmail.rs index a1828b0..82b067c 100644 --- a/examples/smtp_gmail.rs +++ b/examples/smtp_gmail.rs @@ -1,5 +1,5 @@ use async_smtp::smtp::authentication::Credentials; -use async_smtp::{EmailAddress, Envelope, SendableEmail, SmtpClient, Transport}; +use async_smtp::{EmailAddress, Envelope, SendableEmail, SmtpClient}; fn main() { async_std::task::block_on(async move { diff --git a/src/smtp/smtp_client.rs b/src/smtp/smtp_client.rs index ffeec4f..b12619b 100644 --- a/src/smtp/smtp_client.rs +++ b/src/smtp/smtp_client.rs @@ -411,7 +411,7 @@ impl<'a> SmtpTransport { let client = std::mem::replace(&mut self.client, InnerClient::default()); let ssl_client = client.upgrade_tls_stream(tls_parameters).await?; - std::mem::replace(&mut self.client, ssl_client); + self.client = ssl_client; debug!("connection encrypted");