pub struct ConnectionConfig<A, S = DefaultTlsSetup>where
    S: SetupTls,
    A: Cmd,
{ pub addr: SocketAddr, pub auth_cmd: A, pub security: Security<S>, pub client_id: ClientId, }
Expand description

Configuration specifing how to setup an SMTP connection.

Use the ConnectionBuilder to crate it. (Expect if you need a unencrypted connection, in which case you have to crate it by hand. It’s not recommended to use unencrypted connections for mail).

Example

use new_tokio_smtp::{ConnectionBuilder, Domain};
use new_tokio_smtp::command::auth::Login;

// For connecting with auth Login using the defaults, i.e.:
// STARTTLS, port 587 and the ip gotten from resolving
// the passed in domain/host name as well as the hostname
// as client identity.
let host = "smtp.gmail.com".parse()
    .expect("malformed domain/host name");
let config = ConnectionBuilder
    ::new(host)
    .expect("could not resolve host name")
    .auth(Login::new("user", "password"))
    .build();

Fields§

§addr: SocketAddr

the address and port to connect to (i.e. the ones of the smtp server)

§auth_cmd: A

a command used for authentication (use NOOP if you don’t auth)

§security: Security<S>

the kind of TLS mechanism used when setting up the connection

§client_id: ClientId

the client identity, i.e. your “identity”

This is relevant for the communication between smtp server, through for connecting to an MSA (e.g. thunderbird connecting to gmail) using localhost ([127.0.0.1]) is enough

Implementations§

Calls Connection::connect(self).

Creates a connection to 127.0.01 without any form of encryption.

While this is possible it is not a good idea use this for anything but test setups.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.