#[non_exhaustive]pub enum AuthMechanism {
Plain,
Login,
XOAuth2,
}Expand description
SASL authentication mechanisms supported by this client.
Today the crate implements PLAIN (RFC 4616) and LOGIN (the
historical mechanism used by many submission servers). The enum is
non_exhaustive so that future additions (e.g. XOAUTH2,
SCRAM-SHA-256) do not require a major version bump.
PLAIN is preferred when both are advertised: it is one network
round-trip rather than two, and is an IETF-standard SASL mechanism.
LOGIN is retained for compatibility with older submission servers
that advertise only it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Plain
SASL PLAIN (RFC 4616). Sends \0user\0pass base64-encoded as
the initial response, completing in a single round-trip.
Login
LOGIN. Sends username and password as separate base64 lines
in response to two 334 server prompts.
XOAuth2
SASL XOAUTH2 (Google / Microsoft OAuth 2.0 SMTP extension).
Sends user={user}\x01auth=Bearer {token}\x01\x01
base64-encoded as the initial response. The “credential” passed
to login_with for this mechanism is an OAuth 2.0 access
token, not a static password — auto-selection by login()
deliberately does NOT pick this mechanism for that reason.
Implementations§
Trait Implementations§
Source§impl Clone for AuthMechanism
impl Clone for AuthMechanism
Source§fn clone(&self) -> AuthMechanism
fn clone(&self) -> AuthMechanism
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more