diff --git a/src/transport/smtp/async_transport.rs b/src/transport/smtp/async_transport.rs index 68fcf60..c1b43f6 100644 --- a/src/transport/smtp/async_transport.rs +++ b/src/transport/smtp/async_transport.rs @@ -215,9 +215,12 @@ where /// ```rust,no_run /// use lettre::{ /// message::header::ContentType, transport::smtp::authentication::Credentials, - /// AsyncSmtpTransport, Message, Transport, + /// AsyncSmtpTransport, AsyncTransport, Message, Tokio1Executor, /// }; + /// # use tokio1_crate as tokio; /// + /// # #[tokio::main] + /// # async fn main() -> Result<(), Box> { /// let email = Message::builder() /// .from("NoBody ".parse().unwrap()) /// .reply_to("Yuin ".parse().unwrap()) @@ -228,15 +231,20 @@ where /// .unwrap(); /// /// // Open a remote connection to gmail - /// let mailer = AsyncSmtpTransport::from_url("smtps://username:password@smtp.example.com:465") + /// let mailer: AsyncSmtpTransport = + /// AsyncSmtpTransport::::from_url( + /// "smtps://username:password@smtp.example.com:465", + /// ) /// .unwrap() /// .build(); /// /// // Send the email - /// match mailer.send(&email).await { + /// match mailer.send(email).await { /// Ok(_) => println!("Email sent successfully!"), /// Err(e) => panic!("Could not send email: {e:?}"), /// } + /// # Ok(()) + /// # } /// ``` #[cfg(any(feature = "native-tls", feature = "rustls-tls", feature = "boring-tls"))] #[cfg_attr( diff --git a/src/transport/smtp/client/async_connection.rs b/src/transport/smtp/client/async_connection.rs index f14f79d..5eb4203 100644 --- a/src/transport/smtp/client/async_connection.rs +++ b/src/transport/smtp/client/async_connection.rs @@ -73,15 +73,23 @@ impl AsyncSmtpConnection { /// # Example /// /// ```no_run + /// # use std::time::Duration; + /// # use lettre::transport::smtp::{client::{AsyncSmtpConnection, TlsParameters}, extension::ClientId}; + /// # use tokio1_crate::{self as tokio, net::ToSocketAddrs as _}; + /// # + /// # #[tokio::main] + /// # async fn main() -> Result<(), Box> { /// let connection = AsyncSmtpConnection::connect_tokio1( /// ("example.com", 465), /// Some(Duration::from_secs(60)), /// &ClientId::default(), - /// Some(TlsParameters::new("example.com")?), + /// Some(TlsParameters::new("example.com".to_owned())?), /// None, /// ) /// .await - /// .unwrap() + /// .unwrap(); + /// # Ok(()) + /// # } /// ``` #[cfg(feature = "tokio1")] pub async fn connect_tokio1(