pub enum SmtpError {
Io(IoError),
Protocol(ProtocolError),
Auth(AuthError),
InvalidInput(InvalidInputError),
Policy(PolicyError),
}Expand description
Top-level error type for all SMTP operations.
§Logging caveat
The Display output of SmtpError (and of
the variants Protocol(ProtocolError) and Auth(AuthError) in
particular) embeds the server’s reply text verbatim. SMTP servers
commonly include the rejected envelope address in their reply
— e.g. 550 5.1.1 <user@example.com>: recipient does not exist
— and may include other PII the application would not log of its
own accord. When emitting these errors to a shared log channel,
consider:
- Logging only the structured fields you care about
(
during,actual,enhanced,code) and not the free-textmessagefield. - Truncating the message to a fixed length.
- Filtering / redacting addresses with an application-level regex if your compliance posture requires it.
joined_text() (the source of the message fields) is documented
to potentially contain \n; see crate::protocol::Reply::joined_text.
Variants§
Io(IoError)
Underlying transport (socket) failure, including connection close.
Protocol(ProtocolError)
Server response did not match SMTP grammar or expected code.
Auth(AuthError)
Authentication exchange failed or no compatible mechanism was offered.
InvalidInput(InvalidInputError)
Caller-supplied input violated SMTP constraints before any byte was sent on the wire.
Policy(PolicyError)
A crate::policy::SendPolicy rejected the send before any SMTP
command was issued.
Trait Implementations§
Source§impl Error for SmtpError
impl Error for SmtpError
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()