modo_email/lib.rs
1//! Transactional email for the modo framework.
2//!
3//! `modo-email` provides Markdown-based email templates, responsive HTML rendering,
4//! plain-text fallback generation, and pluggable delivery transports (SMTP and Resend).
5//!
6//! # Quick Start
7//!
8//! ```rust,no_run
9//! use modo_email::{mailer, EmailConfig, SendEmail};
10//!
11//! # async fn example() -> Result<(), modo::Error> {
12//! let config = EmailConfig::default(); // load from YAML in practice
13//! let m = mailer(&config)?;
14//!
15//! m.send(
16//! &SendEmail::new("welcome", "user@example.com")
17//! .var("name", "Alice"),
18//! ).await?;
19//! # Ok(())
20//! # }
21//! ```
22
23mod config;
24mod factory;
25mod mailer;
26mod message;
27pub mod template;
28pub mod transport;
29
30pub use config::{EmailConfig, TransportBackend};
31pub use mailer::Mailer;
32pub use message::{MailMessage, SendEmail, SendEmailPayload, SenderProfile};
33pub use template::{EmailTemplate, TemplateProvider};
34pub use transport::{MailTransport, MailTransportDyn, MailTransportSend};
35
36#[cfg(feature = "resend")]
37pub use config::ResendConfig;
38#[cfg(feature = "smtp")]
39pub use config::{SmtpConfig, SmtpSecurity};
40
41pub use factory::{mailer, mailer_with};
42pub use template::CachedTemplateProvider;
43pub use template::filesystem::FilesystemProvider;
44pub use template::layout::LayoutEngine;