Providers & sender
TenantEmailConfig lets each tenant pick SMTP, Resend or SendGrid via a factory pattern, with sender and reply-to per tenant. Credentials are encrypted at rest. Links in emails use the tenant's base URL — https://{customDomain} if verified, else https://{slug}.studeia.com.
Templates
A Handlebars template engine (variables + a branded layout) ships 40 default templates (10 slugs × 4 locales). Templates are editable and previewable in the admin UI.
Delivery, preferences & digest
- EmailService handles Redis rate limiting, retries and an opt-out check before sending.
- Preferences per user; unsubscribe via signed JWT (no predictable fallback).
- DigestService sends daily/weekly summaries.
- Logs + webhooks record delivery status (EmailLog).
Automations & native events
The send_email automation action sends via this service (template slug or inline subject+HTML, targeting trigger_user, users_with_tag, course_students or a custom address). Native events such as enrollment also fire templated emails.