Purpose
Send personalized email campaigns from a CSV-driven dataset while keeping an audit trail of what was sent.
Current state
Last touched: 2025-10-19. Functionality and completeness: Core mailer features are documented; tests and CI are pending.
Next step
Add baseline automated tests to cover critical flows; Add CI pipeline for build/test/lint; Document deployment/runtime environment (or add Dockerfile); Document interfaces (CLI flags, API endpoints, file formats); Add structured logging and basic health checks.
Interfaces
Inputs- HTML template, CSV with `email` and `subject`, config.toml for SMTP and campaign settings
- Configuration files (TOML/YAML/JSON/INI/CONF)
- CSV files
- Browser form inputs
Outputs- Sent email messages
- `emails_sent/<campaign>.csv` log
- `app.log`
- CSV files
- Rendered HTML output
Reality to Action trace
Reality IngestionNot in scope.
Canonical StorageContributes in this stage.
Automation EnginesNot in scope.
Human InterfacesContributes in this stage.
Operational AdoptionContributes in this stage.
Core workflow
TBD. Document the 5-10 steps that define the core workflow.
Artifacts
- CSV requires `email` and `subject`; additional columns map to `{{variable}}` placeholders; optional `attachment_id` columns
Operational notes
Constraints and scars
- Large campaigns may produce sizable log files; attachment matching depends on filenames in the attachments directory.
Reliability posture
Failure modes and safe behavior: SMTP failures log errors and skip; dry-run avoids sends. Idempotency / retries / batching behavior: Campaign de-duplication avoids resends when `campaign_id` is reused.
Observability
- Logs: Rust logging framework detected (log/tracing/env_logger). All actions are logged to the console and to app.log.
- Metrics/health checks: None documented; use logs and sent CSV ledger
Security and privacy
Protect SMTP credentials and recipient lists; avoid committing configs and CSVs with PII.
Ownership
OwnersJosh Barton
UsersJosh Barton (owner)
email_template_mailer
Architecture & Major Components
High-level diagram (text):
- Entry/trigger -> core logic -> outputs (details per docs below)
Entry/trigger
→core logic
→outputs
Entry points: src/main.rs
Top-level folders: attachments, emails_sent, src
Key abstractions: template renderer, CSV reader, SMTP sender, campaign ledger
Setup / Build / Run
- Build system(s): Cargo.
- Prepare a config.toml with SMTP settings and run in dry-run mode before live sends.