Executor refactor (#545)
* Executor * Move transports inside the transport module * AsyncTransport refactor * Update examples * Update docs * impl Default for AsyncSendmailTransport * Implement AsyncFileTransport::read * Generalize AsyncFileTransport AsyncTransport implementation * Remove remaining uses of AsyncSmtpConnector
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use lettre::{
|
||||
transport::smtp::authentication::Credentials, AsyncSmtpTransport, AsyncStd1Connector,
|
||||
transport::smtp::authentication::Credentials, AsyncSmtpTransport, AsyncStd1Executor,
|
||||
AsyncStd1Transport, Message,
|
||||
};
|
||||
|
||||
@@ -18,10 +18,11 @@ async fn main() {
|
||||
let creds = Credentials::new("smtp_username".to_string(), "smtp_password".to_string());
|
||||
|
||||
// Open a remote connection to gmail
|
||||
let mailer = AsyncSmtpTransport::<AsyncStd1Connector>::relay("smtp.gmail.com")
|
||||
.unwrap()
|
||||
.credentials(creds)
|
||||
.build();
|
||||
let mailer: AsyncSmtpTransport<AsyncStd1Executor> =
|
||||
AsyncSmtpTransport::<AsyncStd1Executor>::relay("smtp.gmail.com")
|
||||
.unwrap()
|
||||
.credentials(creds)
|
||||
.build();
|
||||
|
||||
// Send the email
|
||||
match mailer.send(email).await {
|
||||
|
||||
Reference in New Issue
Block a user