Skip to main content

oxidite_mail/
lib.rs

1// Nodemailer-style email library for Rust
2
3pub mod mailer;
4pub mod message;
5pub mod transport;
6pub mod attachment;
7
8pub use mailer::Mailer;
9pub use message::Message;
10pub use transport::{SmtpTransport, SmtpConfig};
11pub use attachment::Attachment;
12
13/// Email errors
14#[derive(Debug, thiserror::Error)]
15pub enum MailError {
16    #[error("SMTP error: {0}")]
17    Smtp(String),
18    
19    #[error("Invalid email address: {0}")]
20    InvalidAddress(String),
21    
22    #[error("Missing required field: {0}")]
23    MissingField(String),
24    
25    #[error("Attachment error: {0}")]
26    Attachment(String),
27    
28    #[error("Transport error: {0}")]
29    Transport(#[from] lettre::transport::smtp::Error),
30    
31    #[error("Address error: {0}")]
32    Address(#[from] lettre::address::AddressError),
33    
34    #[error("Email building error: {0}")]
35    EmailBuilder(#[from] lettre::error::Error),
36}
37
38pub type Result<T> = std::result::Result<T, MailError>;