Email

SMTP for your apps; every message kept, relayed when you want it delivered.

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

Email architectureApps send through Mailpit, which keeps a copy and relays if you choose.SMTPrelayYour appMailpitSMTP, kept messagesYour provider’s SMTPoptional
Apps send through Mailpit, which keeps a copy and relays if you choose.
  • Your app to Mailpit: SMTP
  • Mailpit to Your provider’s SMTP: relay

Flows

Sending a password reset

  1. The app sends through the service.
  2. The message appears under Messages.
  3. With a relay, it is delivered to the recipient too.

Set it up

In the console

  1. Open Email and choose New email service.
  2. Leave the relay empty to only keep messages, or add your provider.
  3. Point your app at the SMTP address and password.

With the CLI

enclave email create mail --wait

With 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.

enclave_email
NameTypeUseWhat it does
nametextrequiredName of the email service: 3–40 lowercase letters, digits or hyphens, starting with a letter. Changing it replaces the email service.
domaintextoptionalThe API sends only from this domain.
keep_messagesnumberoptionalMessages kept to look at, 10–10000 (default 500).
machinetextoptionalThe 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_labelsmap of textoptionalLabels the machine must have, when machine isn't set (key=value, all must match).
networktextoptionalNetwork to place it in (default: the default network). Changes in place.
projecttextoptionalThe project to create it in. Defaults to the provider's project (ENCLAVE_PROJECT, else default). Changing it replaces the resource.
relaylist of objectsoptionalDeliver through this SMTP relay (your provider).
subnettextoptionalSubnet of the network (default: its first).
idtextoutputResource ID.
internal_smtp_hosttextoutputSMTP host inside its network (port 1025).
modetextoutputcapture or relay.
password_secrettextoutputName of the managed secret holding the SMTP password.
smtp_hosttextoutputSMTP host on this machine.
smtp_portnumberoutputSMTP port on this machine.
usernametextoutputSMTP user.
web_urltextoutputThe 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.