lettre::transport::smtp::client

Struct TlsParametersBuilder

Source
pub struct TlsParametersBuilder { /* private fields */ }
Expand description

Builder for TlsParameters

Implementations§

Source§

impl TlsParametersBuilder

Source

pub fn new(domain: String) -> Self

Creates a new builder for TlsParameters

Source

pub fn certificate_store(self, cert_store: CertificateStore) -> Self

Set the source for the base set of root certificates to trust.

Source

pub fn add_root_certificate(self, cert: Certificate) -> Self

Add a custom root certificate

Can be used to safely connect to a server using a self signed certificate, for example.

Source

pub fn dangerous_accept_invalid_hostnames( self, accept_invalid_hostnames: bool, ) -> Self

Controls whether certificates with an invalid hostname are accepted

Defaults to false.

§Warning

You should think very carefully before using this method. If hostname verification is disabled any valid certificate, including those from other sites, are trusted.

This method introduces significant vulnerabilities to man-in-the-middle attacks.

Hostname verification can only be disabled with the native-tls TLS backend.

Source

pub fn set_min_tls_version(self, min_tls_version: TlsVersion) -> Self

Controls which minimum TLS version is allowed

Defaults to Tlsv12.

Source

pub fn dangerous_accept_invalid_certs(self, accept_invalid_certs: bool) -> Self

Controls whether invalid certificates are accepted

Defaults to false.

§Warning

You should think very carefully before using this method. If certificate verification is disabled, any certificate is trusted for use, including:

  • Self signed certificates
  • Certificates from different hostnames
  • Expired certificates

This method should only be used as a last resort, as it introduces significant vulnerabilities to man-in-the-middle attacks.

Source

pub fn build(self) -> Result<TlsParameters, Error>

Creates a new TlsParameters using native-tls, boring-tls or rustls depending on which one is available

Source

pub fn build_native(self) -> Result<TlsParameters, Error>

Creates a new TlsParameters using native-tls with the provided configuration

Trait Implementations§

Source§

impl Clone for TlsParametersBuilder

Source§

fn clone(&self) -> TlsParametersBuilder

Returns a copy 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 Debug for TlsParametersBuilder

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, dst: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.