Skip to content

Email

Hotaru sends three emails about accounts, through Resend (SI-564, SI-575):

Email To When
Confirm your email for Hotaru the new account Someone registers while registration is open, or tries to log in before confirming (accounts.md)
Reset your Hotaru password the account Someone asks on Forgot your password? (auth.md)
You’re invited to Hotaru the invite’s address An admin makes an invite for an email address on Settings → Accounts (accounts.md)

Each is plain text plus simple HTML, in English. Links point at BETTER_AUTH_URL (or ORIGIN), the app’s public URL. An invite for anyone with the link isn’t emailed: the admin copies the link and passes it on.

Setting it up

  1. In Resend, add a sending domain, such as mail.example.com, and add the DNS records it shows. With Cloudflare, Auto configure does that; the records must be DNS only, not proxied.
  2. Create an API key with Sending access, limited to that domain.
  3. Set both in the app’s environment (in Coolify, never in the repository):
Variable Value
RESEND_API_KEY the key, re_…
EMAIL_FROM the sender, such as Hotaru <[email protected]>

Both are needed: with only the key, the server log warns once and emails go to the log as below. Redeploy. Settings → Accounts stops saying that this instance doesn’t send email.

Sending never blocks a page: when Resend refuses or can’t be reached, the error goes to the server log ([email] …, never the key) and the page carries on. Someone who didn’t get a confirmation link gets a new one by logging in.

EMAIL_FROM is used without surrounding quotes: a value pasted as "Hotaru <[email protected]>", quotes and all, still works.

When an email doesn’t arrive

The server log (Coolify → the app → Logs) has one line for each email sent through Resend:

Log line Means
[email] Resend accepted "…" (id …) Resend took it. Look the id up in Resend’s Emails log: delivered, bounced, or suppressed.
[email] Resend refused "…": 403 validation_error: … Resend said no, and why: often the domain isn’t verified, the key may only send from another domain, or EMAIL_FROM isn’t a valid sender.
[email] Sending "…" failed: … Resend couldn’t be reached (network, timeout).
[Better Auth]: Reset Password: User not found Nobody has that email, so no reset email went out.
[auth] Password reset request failed: … Better Auth refused the reset request itself (with its status and reason), so no email went out.
none of these The server doesn’t use Resend: RESEND_API_KEY or EMAIL_FROM doesn’t reach it. Forgot your password? then says that the instance doesn’t send email.

Settings → Accounts shows the admin the sender and the last success or failure since the server started (SI-579).

In Resend, check:

  1. Domains: the sender’s domain (the part after @ in EMAIL_FROM) is listed and Verified. Pending or failed means its DNS records (SPF, DKIM, and MX for the bounce subdomain) are missing or proxied.
  2. API Keys: the key’s permission is Sending access for that domain or for all domains. A key limited to another domain is refused.
  3. Emails: the log of every email, with its status. Bounced or Suppressed means Resend tried; the address or the receiving server refused.

Without Resend

Without RESEND_API_KEY and EMAIL_FROM, every email is written to the server log instead ([email] To …: <subject>, the link included), so the operator can pass the link on. That’s how development works, with no key. Invites are the exception: they aren’t sent at all, and stay out of the log, since Settings → Accounts shows the admin their link (accounts.md). POST /api/v1/admin/invites answers emailed: false then.

  • pnpm dev: emails are printed in the terminal.
  • EMAIL_OUTBOX=<folder>: each email is written there as a JSON file. The e2e tests use test-results/e2e/outbox.

Code