[−][src]Struct new_tokio_smtp::ConnectionBuilder
Builder for an ConnectionConfig
for a encrypted smtp connection.
Implementations
impl ConnectionBuilder<Noop, DefaultTlsSetup>
[src]
pub fn new(host: Domain) -> Result<Self, Error>
[src]
Create a new ConnectionBuilder
based on a domain name/host name.
The used port will be DEFAULT_SMTP_MSA_PORT
i.e. 587.
The used socket address will be generate from using std's ToSocketAddrs
with the given host and default port (the first address returned by
to_socket_addrs
is used, if there is non an std_io::Error
is generated).
Error
std::net::ToSocketAddrs
is used internally and can cause an
io error, e.g. if it can not resolve an address for the given
host name.
pub fn new_with_port(host: Domain, port: u16) -> Result<Self, Error>
[src]
Create a new ConnectionBuilder
based on a domain name/host name and port.
The used socket address will be generate from using std's ToSocketAddr
with the given host and the given port.
Error
std::net::ToSocketAddrs
is used internally and can cause an
io error, e.g. if it can not resolve an address for the given
host name.
pub fn new_with_addr(addr: SocketAddr, domain: Domain) -> Self
[src]
Crate a new ConnectionBuilder
based on a ip address, port and domain name.
The domain name is used for Server Name Identification (SNI) and Tls hostname verification (hostname of the server).
impl<A, S> ConnectionBuilder<A, S> where
S: SetupTls,
A: Cmd,
[src]
S: SetupTls,
A: Cmd,
pub fn use_tls_setup<S2: SetupTls>(self, setup: S2) -> ConnectionBuilder<A, S2>
[src]
Use a different TlsSetup
implementation.
This can be used if an advanced Tls configuration is needed, e.g. if you want to:
- use client certificate authentication
- change the min/max protocol version
- add a root certificate
- disable sni
- and some crazy stuff like disable hostname verification, or certificate verification
pub fn use_start_tls(self) -> Self
[src]
Make the builder use STARTTLS
security when building.
pub fn use_direct_tls(self) -> Self
[src]
Make the builder use direct tls security when building.
This is sometimes known as "wrapped" mode, it used a Tcp/Tls channel for transport instead of a pure Tcp channel.
This often requires a different port as port 587 is reserved for "normal" mail submission (using the STARTTLS command) by RFC 6409.
While direct tls is conform with smtp itself (RFC 5321) part of RFC 6409 which further specifies how the smtp should be used when a user (i.e. a mail program) wants to submit a mail to an Mail Submission Agent (MSA).
pub fn auth<NA: Cmd>(self, auth_cmd: NA) -> ConnectionBuilder<NA, S>
[src]
Set the command to use for authentication.
If this function is not called Noop
is used,
i.e. no authentication is done.
pub fn client_id(self, id: ClientId) -> Self
[src]
Set's the client identity to the given identity.
(The default is to use ClientId::hostname()
)
pub fn syntax_error_handling(self, method: SyntaxErrorHandling) -> Self
[src]
Set's if syntax errors are handled lax or strict when setting up a connection.
(Currently this only affects EHLO.)
pub fn build(self) -> ConnectionConfig<A, S>
[src]
Creates a new connection config.
If not specified differently, then
ClientId::hostname()
is used asClientId
Noop
is used as authentication command, i.e. no auth is doneStartTls
is used as security methodDefaultTlsSetup
is used for setting up tls (i.e. no special options are set)
pub fn connect(
self
) -> impl Future<Item = Connection, Error = ConnectingFailed> + Send
[src]
self
) -> impl Future<Item = Connection, Error = ConnectingFailed> + Send
Calls Connection::connect(self.build())
.
Trait Implementations
Auto Trait Implementations
impl<A, S> RefUnwindSafe for ConnectionBuilder<A, S> where
A: RefUnwindSafe,
S: RefUnwindSafe,
A: RefUnwindSafe,
S: RefUnwindSafe,
impl<A, S> Send for ConnectionBuilder<A, S>
impl<A, S> Sync for ConnectionBuilder<A, S> where
A: Sync,
S: Sync,
A: Sync,
S: Sync,
impl<A, S> Unpin for ConnectionBuilder<A, S> where
A: Unpin,
S: Unpin,
A: Unpin,
S: Unpin,
impl<A, S> UnwindSafe for ConnectionBuilder<A, S> where
A: UnwindSafe,
S: UnwindSafe,
A: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,