Overview
An email service gives your apps an SMTP server. Every message is kept so you can read it in the console; add your email provider as a relay when you want messages delivered.
When to use it
- Password resets and receipts.
- Seeing exactly what your app sends while you build.
- Alert emails from EnclaveStack.
How it works
- Mailpit 1.28
- One container per email service: SMTP with authentication and a web view of every message.
- Relay
- Optionally sends every message on through your provider’s SMTP, with STARTTLS or TLS.
Apps send with the service’s user and password. Messages are kept up to your limit (500 by default). Without a relay nothing leaves the machine.
Architecture
- Your app to Mailpit: SMTP
- Mailpit to Your provider’s SMTP: relay
Flows
Sending a password reset
- The app sends through the service.
- The message appears under Messages.
- With a relay, it is delivered to the recipient too.
Set it up
In the console
- Open Email and choose New email service.
- Leave the relay empty to only keep messages, or add your provider.
- Point your app at the SMTP address and password.
With the CLI
enclave email create mail --waitWith OpenTofu
OpenTofu configuration
resource "enclave_email" "mail" {
name = "mail"
}Settings reference
Every setting and output of the OpenTofu resource; the console and the CLI use the same names in their own words. Generated from platform 4d30582.
| Name | Type | Use | What it does |
|---|---|---|---|
name | text | required | Name of the email service: 3–40 lowercase letters, digits or hyphens, starting with a letter. Changing it replaces the email service. |
domain | text | optional | The API sends only from this domain. |
keep_messages | number | optional | Messages kept to look at, 10–10000 (default 500). |
machine | text | optional | The machine to run on (default: EnclaveStack chooses, and this reads back its choice). Changing it moves the resource, with its data, in place; apply waits for the move. |
machine_labels | map of text | optional | Labels the machine must have, when machine isn't set (key=value, all must match). |
network | text | optional | Network to place it in (default: the default network). Changes in place. |
project | text | optional | The project to create it in. Defaults to the provider's project (ENCLAVE_PROJECT, else default). Changing it replaces the resource. |
relay | list of objects | optional | Deliver through this SMTP relay (your provider). |
subnet | text | optional | Subnet of the network (default: its first). |
id | text | output | Resource ID. |
internal_smtp_host | text | output | SMTP host inside its network (port 1025). |
mode | text | output | capture or relay. |
password_secret | text | output | Name of the managed secret holding the SMTP password. |
smtp_host | text | output | SMTP host on this machine. |
smtp_port | number | output | SMTP port on this machine. |
username | text | output | SMTP user. |
web_url | text | output | The message viewer on this machine (same user and password). |
Limits and security
Good to know
- 10 – 10 000 kept messages.
Security
- SMTP needs the user and password; relay credentials come from a secret.