Struct ConnectionConfig

Source
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, }
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

§syntax_error_handling: SyntaxErrorHandling

How strict error handling is done.

Implementations§

Source§

impl<A> ConnectionConfig<A>
where A: Cmd,

Source

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

Calls Connection::connect(self).

Source§

impl ConnectionConfig<Noop>

Source

pub fn builder_local_unencrypted() -> LocalNonSecureBuilder<Noop>

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.

Source

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

Source

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

Source

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

Trait Implementations§

Source§

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

Source§

fn clone(&self) -> ConnectionConfig<A, S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

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

§

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

§

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§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HeaderTryFrom<T> for T

Source§

impl<F, T> HeaderTryInto<T> for F
where T: HeaderTryFrom<F>,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Erased for T