Skip to content

Configure email with SMTP

Send invitations, password resets, reports and alerts through an SMTP server, set up in the app or with environment variables.

Supermetry sends email through an SMTP server you choose. You can set it up in the app (instance admins) or with environment variables. Both reach the same sender, and the app has a button that sends a test message.

  • Invitations to an organization.
  • Password reset links.
  • A welcome email after an account is created.
  • Scheduled email reports.
  • Alerts sent to an email channel.
  • Account notices: confirming a new email address, telling the old address it changed, and warnings before a deleted site or organization is purged.

With no SMTP server configured, nothing is sent and the app falls back to links you copy:

  • An invitation shows Copy invitation link. Send it to the person yourself.
  • A password reset shows its link instead of emailing it. As an administrator you can also run supermetry user reset-password --email USER, which prints the link when email is off (see the CLI commands).
  1. Sign in as an instance admin and open Instance administration, then Email (SMTP).
  2. Fill in the host, port, connection security, username, password and From address. Pick the connection security that matches the port: STARTTLS for 587, implicit TLS for 465.
  3. Select Save email settings. The change applies without a restart.
  4. Under Send a test email, enter an address you can read and select Send test email.

What you should see: a confirmation that the message was handed to the mail server. If it fails, the message names the step that failed, for example authenticate SMTP. See Email not arriving.

The password is stored encrypted and is never shown again. Leave the password field empty to keep the saved one, or select Remove saved password to delete it. When you change the host or the username, enter the password again: a saved password is never sent to a different server. Remove email settings turns email off.

This screen is not available on instances run by an operator (SUPERMETRY_MANAGED=true).

Option 2: set up email with environment variables

Section titled “Option 2: set up email with environment variables”

Use this for configuration kept in files or in infrastructure as code.

  1. Open the environment file created by the installer.

    For a Linux binary install:

    Terminal window
    sudoedit /etc/supermetry/supermetry.env

    For Docker:

    Terminal window
    cd /opt/supermetry
    ${EDITOR:-vi} .env
  2. Add the settings.

    SUPERMETRY_SMTP_HOST=smtp.example.com
    SUPERMETRY_SMTP_PORT=587
    SUPERMETRY_SMTP_TLS=starttls
    SUPERMETRY_SMTP_USER=supermetry
    SUPERMETRY_SMTP_PASS=CHANGE_ME
    SUPERMETRY_SMTP_FROM="Supermetry <analytics@example.com>"
  3. Restart Supermetry.

    Terminal window
    sudo systemctl restart supermetry

    For Docker:

    Terminal window
    cd /opt/supermetry
    docker compose restart supermetry

Precedence: when SUPERMETRY_SMTP_HOST is set, the environment wins entirely. The app’s Email (SMTP) screen then shows those values read-only, without the password, and cannot change them. Unset the host and restart to manage email in the app instead. The test button still works and uses the effective settings.

Variable Default Meaning
SUPERMETRY_SMTP_HOST empty SMTP server. Empty means no email from the environment.
SUPERMETRY_SMTP_PORT 587 Port from 1 to 65535.
SUPERMETRY_SMTP_TLS starttls starttls, implicit or none. Port 465 with no TLS variable set means implicit.
SUPERMETRY_SMTP_STARTTLS true Older boolean switch. Prefer SUPERMETRY_SMTP_TLS.
SUPERMETRY_SMTP_USER empty Username. Requires starttls or implicit.
SUPERMETRY_SMTP_PASS empty Password. Treat it as a secret.
SUPERMETRY_SMTP_FROM empty Sender address, for example "Supermetry <analytics@example.com>". Required when the host is set.
SUPERMETRY_SMTP_HELO derived Name announced in the greeting. Default: the host of SUPERMETRY_BASE_URL, else the domain of the sender address.

Supermetry refuses to start, naming the variable, when:

  • SUPERMETRY_SMTP_PORT must be an integer from 1 to 65535
  • SUPERMETRY_SMTP_STARTTLS must be a boolean
  • SUPERMETRY_SMTP_TLS must be starttls, implicit or none
  • SUPERMETRY_SMTP_TLS and SUPERMETRY_SMTP_STARTTLS disagree; set only SUPERMETRY_SMTP_TLS
  • SUPERMETRY_SMTP_USER requires TLS: use SUPERMETRY_SMTP_TLS=starttls or implicit
  • SUPERMETRY_SMTP_FROM is required when SUPERMETRY_SMTP_HOST is set
  • SUPERMETRY_SMTP_HELO must be a host name
Mode Typical port Behavior
starttls 587 Connects in plain text, then upgrades the connection with STARTTLS before sending a username or password.
implicit 465 TLS from the first byte (SMTPS).
none 25 No encryption. For an unauthenticated relay you trust, such as one on the same host. A username is refused in this mode.

The server certificate is always verified against the host name you configure, with TLS 1.2 or later. There is no option to skip verification. If the server presents a certificate for a different name, use the name on the certificate as the host.

These are starting points, not recommendations. Hosts, ports and credential types change, so confirm each value in the provider’s own documentation.

Service Host Port and mode Username and password
Amazon SES email-smtp.REGION.amazonaws.com 587 starttls or 465 implicit SMTP credentials created in SES (not your AWS access keys). The sender address or domain must be verified, and a new account may be limited to verified recipients.
Postmark smtp.postmarkapp.com 587 starttls A server token, used for both username and password. The sender signature or domain must be confirmed.
Mailgun smtp.mailgun.org (EU region: smtp.eu.mailgun.org) 587 starttls SMTP credentials of a verified sending domain.
Resend smtp.resend.com 465 implicit or 587 starttls Username resend, password an API key. The sending domain must be verified.
Google Workspace or Gmail smtp.gmail.com 587 starttls or 465 implicit The full account address and an app password (needs 2-step verification; your normal password will not work). The From address should be that account or an alias it may send as.
Local Postfix relay localhost 25 none None. Inside a container, localhost is the container itself, so use an address that reaches the host.

A relay accepting a message does not mean it reaches the inbox. For the domain in SUPERMETRY_SMTP_FROM:

  • Publish an SPF record that includes your provider.
  • Enable DKIM signing at the provider and publish its DNS records.
  • Publish a DMARC record, starting with a monitoring policy.
  • Send from an address on a domain you control, not a free mailbox domain you do not.
  1. Open Instance administration → Email (SMTP) and use Send test email. It uses the effective settings, whether they come from the app or from environment variables.

  2. Then send a real message end to end: open Settings → Organization settings → Invitations, enter an address you can read, and select Invite.

What you should see: the test email or an email titled “You’re invited to Supermetry” arrives with a one-time link. If the app says it was handed to the mail server but nothing arrives, follow the checklist in Email not arriving.