Struct new_tokio_smtp::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,
}
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§
source§impl<A> ConnectionConfig<A, DefaultTlsSetup>where
A: Cmd,
impl<A> ConnectionConfig<A, DefaultTlsSetup>where
A: Cmd,
sourcepub fn connect(
self
) -> impl Future<Item = Connection, Error = ConnectingFailed> + Send
pub fn connect(
self
) -> impl Future<Item = Connection, Error = ConnectingFailed> + Send
Calls Connection::connect(self)
.
source§impl ConnectionConfig<Noop, DefaultTlsSetup>
impl ConnectionConfig<Noop, DefaultTlsSetup>
sourcepub fn builder_local_unencrypted() -> LocalNonSecureBuilder<Noop>
pub fn builder_local_unencrypted() -> LocalNonSecureBuilder<Noop>
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.