[][src]Struct mail_smtp::ConnectionConfig

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

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

Methods

impl<A> ConnectionConfig<A, DefaultTlsSetup> where
    A: Cmd
[src]

pub fn connect(
    self
) -> impl Send + Future<Item = Connection, Error = ConnectingFailed>
[src]

Calls Connection::connect(self).

impl ConnectionConfig<Noop, DefaultTlsSetup>[src]

pub fn builder_local_unencrypted() -> LocalNonSecureBuilder<Noop>[src]

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.

pub fn builder(
    host: Domain
) -> Result<ConnectionBuilder<Noop, DefaultTlsSetup>, Error>
[src]

pub fn builder_with_port(
    host: Domain,
    port: u16
) -> Result<ConnectionBuilder<Noop, DefaultTlsSetup>, Error>
[src]

pub fn builder_with_addr(
    addr: SocketAddr,
    domain: Domain
) -> ConnectionBuilder<Noop, DefaultTlsSetup>
[src]

Trait Implementations

impl<A, S> Debug for ConnectionConfig<A, S> where
    A: Debug + Cmd,
    S: Debug + SetupTls
[src]

impl<A, S> Clone for ConnectionConfig<A, S> where
    A: Clone + Cmd,
    S: Clone + SetupTls
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<A, S> Send for ConnectionConfig<A, S>

impl<A, S> Sync for ConnectionConfig<A, S> where
    A: Sync,
    S: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<T> HeaderTryFrom for T[src]

impl<F, T> HeaderTryInto for F where
    T: HeaderTryFrom<F>, 
[src]