Update to tokio 1.0 (#529)
This commit is contained in:
@@ -14,7 +14,7 @@ This folder contains examples showing how to use lettre in your own projects.
|
||||
- [smtp_starttls.rs] - Send an email over SMTP with STARTTLS and authenticating with username and password.
|
||||
- [smtp_selfsigned.rs] - Send an email over SMTP encrypted with TLS using a self-signed certificate and authenticating with username and password.
|
||||
- The [smtp_tls.rs] and [smtp_starttls.rs] examples also feature `async`hronous implementations powered by [Tokio](https://tokio.rs/).
|
||||
These files are prefixed with `tokio02_` or `tokio03_`.
|
||||
These files are prefixed with `tokio02_` or `tokio1_`.
|
||||
|
||||
[basic_html.rs]: ./basic_html.rs
|
||||
[maud_html.rs]: ./maud_html.rs
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// This line is only to make it compile from lettre's examples folder,
|
||||
// since it uses Rust 2018 crate renaming to import tokio.
|
||||
// Won't be needed in user's code.
|
||||
use tokio03_crate as tokio;
|
||||
use tokio1_crate as tokio;
|
||||
|
||||
use lettre::{
|
||||
transport::smtp::authentication::Credentials, AsyncSmtpTransport, Message, Tokio03Connector,
|
||||
Tokio03Transport,
|
||||
transport::smtp::authentication::Credentials, AsyncSmtpTransport, Message, Tokio1Connector,
|
||||
Tokio1Transport,
|
||||
};
|
||||
|
||||
#[tokio::main]
|
||||
@@ -23,7 +23,7 @@ async fn main() {
|
||||
let creds = Credentials::new("smtp_username".to_string(), "smtp_password".to_string());
|
||||
|
||||
// Open a remote connection to gmail using STARTTLS
|
||||
let mailer = AsyncSmtpTransport::<Tokio03Connector>::starttls_relay("smtp.gmail.com")
|
||||
let mailer = AsyncSmtpTransport::<Tokio1Connector>::starttls_relay("smtp.gmail.com")
|
||||
.unwrap()
|
||||
.credentials(creds)
|
||||
.build();
|
||||
@@ -1,11 +1,11 @@
|
||||
// This line is only to make it compile from lettre's examples folder,
|
||||
// since it uses Rust 2018 crate renaming to import tokio.
|
||||
// Won't be needed in user's code.
|
||||
use tokio03_crate as tokio;
|
||||
use tokio1_crate as tokio;
|
||||
|
||||
use lettre::{
|
||||
transport::smtp::authentication::Credentials, AsyncSmtpTransport, Message, Tokio03Connector,
|
||||
Tokio03Transport,
|
||||
transport::smtp::authentication::Credentials, AsyncSmtpTransport, Message, Tokio1Connector,
|
||||
Tokio1Transport,
|
||||
};
|
||||
|
||||
#[tokio::main]
|
||||
@@ -23,7 +23,7 @@ async fn main() {
|
||||
let creds = Credentials::new("smtp_username".to_string(), "smtp_password".to_string());
|
||||
|
||||
// Open a remote connection to gmail
|
||||
let mailer = AsyncSmtpTransport::<Tokio03Connector>::relay("smtp.gmail.com")
|
||||
let mailer = AsyncSmtpTransport::<Tokio1Connector>::relay("smtp.gmail.com")
|
||||
.unwrap()
|
||||
.credentials(creds)
|
||||
.build();
|
||||
Reference in New Issue
Block a user