Module client

Source
Expand description

SMTP client

SmtpConnection allows manually sending SMTP commands.


use lettre::transport::smtp::{
    client::SmtpConnection, commands::*, extension::ClientId, SMTP_PORT,
};

let hello = ClientId::Domain("my_hostname".to_owned());
let mut client = SmtpConnection::connect(&("localhost", SMTP_PORT), None, &hello, None, None)?;
client.command(Mail::new(Some("user@example.com".parse()?), vec![]))?;
client.command(Rcpt::new("user@example.org".parse()?, vec![]))?;
client.command(Data)?;
client.message("Test email".as_bytes())?;
client.command(Quit)?;

Structs§

Certificate
A certificate that can be used with TlsParametersBuilder::add_root_certificate
Identity
An identity that can be used with TlsParametersBuilder::identify_with
SmtpConnection
Structure that implements the SMTP client
TlsParameters
Parameters to use for secure clients
TlsParametersBuilder
Builder for TlsParameters

Enums§

CertificateStore
Source for the base set of root certificates to trust.
Tls
Specifies how to establish a TLS connection
TlsVersion
TLS protocol versions.