Rust migration Phase 1 — implements real functionality in the previously stubbed mailer-core and mailer-security crates (38 passing tests). mailer-core: Email/EmailAddress/Attachment types, RFC 5322 MIME builder, email format validation with scoring, bounce detection (14 types, 40+ regex patterns), DSN status parsing, retry delay calculation. mailer-security: DKIM signing (RSA-SHA256) and verification, SPF checking, DMARC verification with public suffix list, DNSBL IP reputation checking (10 default servers, parallel queries), all powered by mail-auth 0.7. mailer-bin: Full CLI with validate/bounce/check-ip/verify-email/dkim-sign subcommands plus --management mode for smartrust JSON-over-stdin/stdout IPC.
32 lines
706 B
Rust
32 lines
706 B
Rust
use thiserror::Error;
|
|
|
|
/// Core error types for the mailer system.
|
|
#[derive(Debug, Error)]
|
|
pub enum MailerError {
|
|
#[error("invalid email address: {0}")]
|
|
InvalidEmail(String),
|
|
|
|
#[error("invalid email format: {0}")]
|
|
InvalidFormat(String),
|
|
|
|
#[error("missing required field: {0}")]
|
|
MissingField(String),
|
|
|
|
#[error("MIME encoding error: {0}")]
|
|
MimeError(String),
|
|
|
|
#[error("validation error: {0}")]
|
|
ValidationError(String),
|
|
|
|
#[error("parse error: {0}")]
|
|
ParseError(String),
|
|
|
|
#[error("IO error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
|
|
#[error("regex error: {0}")]
|
|
Regex(#[from] regex::Error),
|
|
}
|
|
|
|
pub type Result<T> = std::result::Result<T, MailerError>;
|