Struct ::exo::be::Smtp

Overview

An Connection to an SMTP server to send emails

Methods

fn new(url: String, user: String, password: String) -> Result

Creates a new SMTP connection. This connection can later be used to send emails.

Example connection with required tls: "smtp://smtp.postmarkapp.com:587?tls=required"

Example

//let smtp = exo::be::Smtp::new("server", "user", "password")?;
//assert!(smtp is exo::be::Smtp);
fn new_system() -> Result

Creates a new SMTP connection to the default email system. This connection can later be used to send emails. It's not allowed to send commercial email over this account!

Example

let smtp = exo::be::Smtp::new_system()?;
assert!(smtp is exo::be::Smtp);
async fn send(self, email: Email) -> Result

Creates a new SMTP connection to the default email system. This connection can later be used to send emails.

Example

let smtp = exo::be::Smtp::new_system()?;
assert!(smtp is exo::be::Smtp);
let email = exo::be::Email::new()
               .to("robert@exolynk.com")
               .to("philippe@exolynk.com")
               .subject("Exolynk Unit Test")
               .body("This message was created by an automated Exolynk unit test");
smtp.send(email).await?;