#[non_exhaustive]pub enum Error {
Io(Arc<Error>),
Auth {
message: String,
response: SmtpResponse,
},
Permanent {
code: u16,
message: String,
response: SmtpResponse,
},
Transient {
code: u16,
message: String,
response: SmtpResponse,
},
Protocol(String),
Parse(String),
Timeout,
Closed,
StartTlsUnavailable,
AllRecipientsFailed {
count: usize,
responses: Vec<SmtpResponse>,
},
SmtpUtf8Required,
}Expand description
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io(Arc<Error>)
Underlying I/O error (includes TLS transport errors).
Wrapped in Arc so that Error can implement Clone.
Auth
Authentication was rejected by the server (RFC 4954 Section 4).
The response field preserves the full server reply so callers can
distinguish transient failures (454) from permanent ones (535).
Permanent
Permanent failure — 5xx response (RFC 5321 Section 4.2.1). Do not retry.
Transient
Transient failure — 4xx response (RFC 5321 Section 4.2.1). May succeed on retry.
Protocol(String)
SMTP protocol violation by the server (RFC 5321 Section 4.2).
Parse(String)
Failed to parse a server response (RFC 5321 Section 4.2).
Timeout
Operation exceeded the caller-supplied timeout (RFC 5321 Section 4.5.3.2).
Closed
The connection has been closed (RFC 5321 Section 3.8).
STARTTLS was requested but the server does not advertise it (RFC 3207).
AllRecipientsFailed
All recipients were rejected (RFC 5321 Section 3.3 / RFC 1854 Section 3).
SmtpUtf8Required
The message or envelope requires SMTPUTF8, but the server does not advertise the SMTPUTF8 extension (RFC 6531 Sections 3.1, 3.3, 3.4).
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Returns true if the error is transient and the operation may succeed on retry.
Transient errors include 4xx SMTP responses (RFC 5321 Section 4.2.1), I/O errors, timeouts, and transient auth failures (454, RFC 4954 Section 4).
Sourcepub fn is_permanent(&self) -> bool
pub fn is_permanent(&self) -> bool
Returns true if the error is permanent and the operation should not be retried.
Permanent errors include 5xx SMTP responses (RFC 5321 Section 4.2.1) and permanent authentication failures (535, RFC 4954 Section 4).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<ValidationError> for Error
impl From<ValidationError> for Error
Source§fn from(e: ValidationError) -> Self
fn from(e: ValidationError) -> Self
Source§impl PartialEq for Error
Compares two SMTP errors for equality.
impl PartialEq for Error
Compares two SMTP errors for equality.
The Io variant compares by std::io::ErrorKind only, since
std::io::Error does not implement PartialEq. Two Io errors with the
same ErrorKind are considered equal even if their messages differ.