# Email

> Klang sends email to verify addresses and reset passwords. Use any SMTP server, or Resend, or none at all, and what the app hides without it.

## What Klang sends

Only account email: verifying an address and resetting a forgotten password. Each email is in
the language the person uses Klang in, with your install’s logo and links to your own hostname.
Nothing in it comes from klang.gg.

## SMTP

Any SMTP server works: your provider’s, a transactional service, or your own. In `.env`:

```bash
SMTP_URL=smtp://user:password@smtp.example.org:587
EMAIL_FROM=Klang <noreply@chat.example.org>
```

- `smtp://…:587` uses STARTTLS; `smtps://…:465` uses TLS from the start.
- Percent-encode special characters of the user and password (`@` is `%40`, `:` is `%3A`).
- `EMAIL_FROM` is required with `SMTP_URL`. Use an address of a domain your SMTP server is allowed
  to send for (SPF and DKIM), or the email lands in spam.

Klang never writes the URL or the sender to its logs.

## Resend

`RESEND_API_KEY` sends through Resend instead. If both are set, Resend wins.

## No email

Leave all three empty (the default). Then:

- nobody verifies their address, and nobody can reset a forgotten password: the app doesn’t
  offer either (no “Forgot your password?”, no “Not verified” notice). Tell people to keep their
  password in a password manager;
- a server’s **verification level** that asks for a verified email (or anything above it) can’t
  be met: only the owner and people with a role can talk there. Leave those servers at a level
  that doesn’t ask for email.

Everything else works.

## Checking it

Register a test account, or use **Forgot your password?** on the sign-in page, and look at the
API’s log if nothing arrives:

```bash
docker compose logs api | grep -i email
```

`email not sent: neither RESEND_API_KEY nor SMTP_URL` means there’s no provider. An SMTP error
(a refused login, a timeout) is logged without the URL.
