pub struct ConnectionBuilder<A, S = DefaultTlsSetup>where
    S: SetupTls,
    A: Cmd,
{ /* private fields */ }
Expand description

Builder for an ConnectionConfig for a encrypted smtp connection.

Implementations

Create a new ConnectionBuilder based on a domain name/host name.

The used port will be DEFAULT_SMTP_MSA_PORT i.e. 587. The used socket address will be generate from using std’s ToSocketAddrs with the given host and default port (the first address returned by to_socket_addrs is used, if there is non an std_io::Error is generated).

Error

std::net::ToSocketAddrs is used internally and can cause an io error, e.g. if it can not resolve an address for the given host name.

Create a new ConnectionBuilder based on a domain name/host name and port.

The used socket address will be generate from using std’s ToSocketAddr with the given host and the given port.

Error

std::net::ToSocketAddrs is used internally and can cause an io error, e.g. if it can not resolve an address for the given host name.

Crate a new ConnectionBuilder based on a ip address, port and domain name.

The domain name is used for Server Name Identification (SNI) and Tls hostname verification (hostname of the server).

Use a different TlsSetup implementation.

This can be used if an advanced Tls configuration is needed, e.g. if you want to:

  • use client certificate authentication
  • change the min/max protocol version
  • add a root certificate
  • disable sni
  • and some crazy stuff like disable hostname verification, or certificate verification

Make the builder use STARTTLS security when building.

Make the builder use direct tls security when building.

This is sometimes known as “wrapped” mode, it used a Tcp/Tls channel for transport instead of a pure Tcp channel.

This often requires a different port as port 587 is reserved for “normal” mail submission (using the STARTTLS command) by RFC 6409.

While direct tls is conform with smtp itself (RFC 5321) part of RFC 6409 which further specifies how the smtp should be used when a user (i.e. a mail program) wants to submit a mail to an Mail Submission Agent (MSA).

Set the command to use for authentication.

If this function is not called Noop is used, i.e. no authentication is done.

Set’s the client identity to the given identity.

(The default is to use ClientId::hostname())

Creates a new connection config.

If not specified differently, then

  • ClientId::hostname() is used as ClientId
  • Noop is used as authentication command, i.e. no auth is done
  • StartTls is used as security method
  • DefaultTlsSetup is used for setting up tls (i.e. no special options are set)

Calls Connection::connect(self.build()).

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.