Create Email Delivery Interface
Create email service abstraction supporting two transports: SQS queue or HTTP POST to containerized email service. Validate config on startup and fail fast if invalid.
Note:
- Config:
EMAIL_TRANSPORT(sqs/http),EMAIL_SERVICE_NAMESPACE(portal/aktion) - SQS: send to
AWS_SQS_EMAIL_QUEUE_URLusing AWS SDK - HTTP: POST to
EMAIL_SERVICE_URL(env var), no authentication (local only), no retry logic - Method:
sendEmail(to, template, namespace, vars) - From address, reply-to, from name configured via env vars (consistent per service)
- Log failures with full context, throw exceptions for caller
Example(s):
Message format (both transports):
{
"to_addresses": ["email@example.com"],
"template": "template-name",
"namespace": "namespace-value",
"template_vars": {
"key": "value"
}
}
Note: from_address, reply_to_addresses, from_name configured via email service env vars (not per-message)