logo
pub struct SmtpTransport { /* private fields */ }
Available on crate feature smtp-transport only.
Expand description

Sends emails using the SMTP protocol

Implementations

Available on crate features native-tls or rustls-tls only.

Simple and secure transport, using TLS connections to communicate with the SMTP server

The right option for most SMTP servers.

Creates an encrypted transport over submissions port, using the provided domain to validate TLS certificates.

Available on crate features native-tls or rustls-tls only.

Simple an secure transport, using STARTTLS to obtain encrypted connections

Alternative to SmtpTransport::relay, for SMTP servers that don’t take SMTPS connections.

Creates an encrypted transport over submissions port, by first connecting using an unencrypted connection and then upgrading it with STARTTLS. The provided domain is used to validate TLS certificates.

An error is returned if the connection can’t be upgraded. No credentials or emails will be sent to the server, protecting from downgrade attacks.

Creates a new local SMTP client to port 25

Shortcut for local unencrypted relay (typical local email daemon that will handle relaying)

Creates a new SMTP client

Defaults are:

  • No authentication
  • No TLS
  • A 60 seconds timeout for smtp commands
  • Port 25

Consider using SmtpTransport::relay or SmtpTransport::starttls_relay instead, if possible.

Tests the SMTP connection

test_connection() tests the connection by using the SMTP NOOP command. The connection is closed afterwards if a connection pool is not used.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Sends an email

Response produced by the Transport

Error produced by the Transport

Available on crate feature builder only.

Sends the email

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more