Expand description
§Armature Mail
Email sending with SMTP, templates, and cloud provider integrations.
§Features
- SMTP Transport: Direct SMTP email sending with TLS support
- Email Templates: HTML and text templates with Handlebars, Tera, or MiniJinja
- Cloud Providers: SendGrid, Mailgun, AWS SES integrations
- Attachments: File and inline attachments
- Async Queue: Non-blocking email sending with retries
§Quick Start
ⓘ
use armature_mail::{Mailer, SmtpConfig, Email};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Configure SMTP
let config = SmtpConfig::new("smtp.example.com")
.credentials("user@example.com", "password")
.port(587)
.starttls();
let mailer = Mailer::smtp(config).await?;
// Send an email
let email = Email::new()
.from("sender@example.com")
.to("recipient@example.com")
.subject("Hello from Armature!")
.text("This is a test email.")
.html("<h1>Hello!</h1><p>This is a test email.</p>");
mailer.send(email).await?;
Ok(())
}§With Templates
ⓘ
use armature_mail::{Mailer, SmtpConfig, TemplateEngine};
use serde_json::json;
let mailer = Mailer::smtp(config).await?
.with_templates("./templates")?;
// Send using a template
mailer.send_template(
"welcome",
"user@example.com",
json!({
"name": "John",
"activation_link": "https://example.com/activate/abc123"
}),
).await?;Modules§
- prelude
- Prelude for common imports.
Structs§
- Address
- Email address with optional display name.
- Attachment
- Email attachment.
- Email message.
- Email
Builder - Email builder with validation.
- Handlebars
Engine - Handlebars-based template engine for emails.
- Mailbox
- A mailbox is an address with a required display name.
- Mailer
- High-level mailer for sending emails.
- Mailer
Config - Mailer configuration.
- Rendered
Template - Rendered template output.
- Smtp
Config - SMTP configuration.
- Smtp
Transport - SMTP transport.
Enums§
- Content
Disposition - Content disposition for attachments.
- Mail
Error - Mail errors.
- Smtp
Security - SMTP security mode.
Traits§
- Into
Address - Trait for types that can be converted to an Address.
- Template
Engine - Template engine trait for rendering email templates.
- Transport
- Email transport trait.
Type Aliases§
- Result
- Result type for mail operations.