[][src]Struct new_tokio_smtp::ConnectionConfig

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, pub syntax_error_handling: SyntaxErrorHandling, }

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

syntax_error_handling: SyntaxErrorHandling

How strict error handling is done.

Implementations

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

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

Calls Connection::connect(self).

impl ConnectionConfig<Noop, DefaultTlsSetup>[src]

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

Creates a connection to 127.0.0.1 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: Clone, S: Clone> Clone for ConnectionConfig<A, S> where
    S: SetupTls,
    A: Cmd
[src]

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

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.