Docs / Directus

Send email in Directus over SMTP

Directus sends password resets, user invitations and the emails your Flows produce, and by default it hands them to sendmail — which a container usually does not have. Mail is configured entirely through environment variables, so connecting it to Postwing takes a few lines and a restart.

✓
You can get them on the token management page. For security reasons, a token is shown only once — at the moment it is created.

SMTP connection settings

SettingValue
SMTP hostsmtp.postwing.app
Port587
EncryptionSTARTTLS (the connection is upgraded to TLS before login)
UsernameThe login of an SMTP token for your domain
PasswordThe password of that token — shown once, when the token is created
ℹ
Every mode is also available on a high port: 8465 (SSL/TLS), 8587 (STARTTLS) and 8025 (plain). Many hosting providers and clouds block outbound 25, 465 and 587 — if the connection times out, switch to the matching high port.

Configure the environment

.env
EMAIL_TRANSPORT="smtp"
EMAIL_FROM="noreply@your-domain.com"
EMAIL_SMTP_HOST="smtp.postwing.app"
EMAIL_SMTP_PORT=587
EMAIL_SMTP_SECURE=false
EMAIL_SMTP_USER="token-login@your-domain.com"
EMAIL_SMTP_PASSWORD="your-token-password"

# Links in password reset and invite emails are built from this
PUBLIC_URL="https://cms.your-domain.com"
VariableValue
EMAIL_TRANSPORTsmtp
EMAIL_FROMnoreply@your-domain.com — on your verified domain
EMAIL_SMTP_HOSTsmtp.postwing.app
EMAIL_SMTP_PORT587
EMAIL_SMTP_SECUREfalse for 587, true for 465
EMAIL_SMTP_USERThe login of an SMTP token for your domain
EMAIL_SMTP_PASSWORDThat token's password
EMAIL_SMTP_NAMEOptional — the hostname Directus announces in EHLO
⚠
It defaults to no-reply@example.com. Every email Directus sends — including those from Flows — uses this one address, so it must be on your verified domain for DKIM and SPF to align.

Docker Compose

The same variables in the environment block:

docker-compose.yml
services:
  directus:
    image: directus/directus:11
    environment:
      PUBLIC_URL: "https://cms.your-domain.com"
      EMAIL_TRANSPORT: "smtp"
      EMAIL_FROM: "noreply@your-domain.com"
      EMAIL_SMTP_HOST: "smtp.postwing.app"
      EMAIL_SMTP_PORT: "587"
      EMAIL_SMTP_SECURE: "false"
      EMAIL_SMTP_USER: "token-login@your-domain.com"
      EMAIL_SMTP_PASSWORD: "your-token-password"

Send email from a Flow

Add a Send Email operation to a Flow. It takes To, Subject, CC, BCC, Reply To and a body type — WYSIWYG, Markdown or a Liquid template from EMAIL_TEMPLATES_PATH. There is no From field: the sender is always EMAIL_FROM. For a contact form, put the visitor's address in Reply To.

Send a test email

Restart Directus and read the log — with EMAIL_VERIFY_SETUP on (the default) it checks the SMTP connection at startup and warns if it fails. Then use Forgot password on the sign-in page or invite a user from the User Directory, or build a Flow with a manual trigger and a Send Email operation.

Troubleshooting

ErrorCause and fix
Nothing is sent, no SMTP errorsEMAIL_TRANSPORT is not smtp, so Directus is still using sendmail.
Startup warning about the email connection Wrong host, port, EMAIL_SMTP_SECURE or credentials.
Connection timeout Outbound port blocked. Use 8587 with EMAIL_SMTP_SECURE=false or 8465 with true.
535 authentication failedWrong token login or password.
Reset or invite link is brokenPUBLIC_URL is not set to the public address.
Mail goes to spam or is rejectedEMAIL_FROM is still no-reply@example.com or another unverified domain.

Frequently asked questions

How do I configure SMTP in Directus?

With environment variables, not in the Data Studio. Set EMAIL_TRANSPORT to smtp, then EMAIL_SMTP_HOST, EMAIL_SMTP_PORT, EMAIL_SMTP_USER, EMAIL_SMTP_PASSWORD and EMAIL_SMTP_SECURE, plus EMAIL_FROM for the sender, and restart Directus. Without EMAIL_TRANSPORT Directus uses sendmail.

Should EMAIL_SMTP_SECURE be true or false?

false with port 587 — the connection is upgraded with STARTTLS before the password is sent. true with port 465, where TLS starts immediately. Leave EMAIL_SMTP_IGNORE_TLS unset: turning it on skips STARTTLS and sends the credentials in plaintext.

Why do Directus emails come from no-reply@example.com?

That is the default value of EMAIL_FROM. Set it to an address on your verified domain — mail from example.com fails DKIM and SPF and is rejected or filtered as spam.

Why is the link in the Directus password reset email wrong?

Directus builds the links in forgot-password and invite emails from PUBLIC_URL. Set it to the address where your Directus instance is reachable from the internet.

Can I set the From address in a Flow's Send Email operation?

No. The operation has To, Subject, CC, BCC, Reply To, a body type (WYSIWYG, Markdown or Template) and the body itself; the sender is always EMAIL_FROM. To answer a form submitter, put their address in Reply To rather than trying to send as them.

How do I know Directus connected to the SMTP server?

EMAIL_VERIFY_SETUP is on by default, so Directus checks the transport at startup and logs a warning if it cannot connect. Read the container log right after a restart.

Next steps