Email

soon Email features are being built right now and may not be in the release you're running yet.

Tally works without email: every feature below hides itself (or falls back to a copyable link) while MAIL_MAILER is log, the default. Turn email on to get:

Feature Without email With email
Forgot password Ask an admin, or ./app tally:user:password Emailed reset link (60 minutes, single use)
Sign-in code Hidden "Email me a sign-in code" on the login page: 6 digits, 10-minute expiry, hashed at rest, 5 attempts per code, rate-limited per email and IP
Invites Copy-the-link flow Invite emailed to the address
Email verification — Changing your email sends a confirmation link; invited and setup accounts start verified
Weekly digest Hidden Per user and site: visitors, pageviews, top pages and sources, change vs. the prior week. Monday 09:00 in the site's timezone
Spike alert Hidden Per user and site: live visitors (last 5 minutes) above a threshold, at most once every 6 hours
Security notices — "Password changed" (always) and "New sign-in" (opt-in)

Preferences live under Settings → Notifications. Digests and spike alerts run inside the server process (the alerts tick, every minute); each send is recorded in alert_sends first, so restarts and extra replicas never send twice.

  1. Onboard your sending domain in the Cloudflare dashboard: Email → Email Service → Sending → Add domain. The domain must use Cloudflare DNS. Let Cloudflare add the SPF, DKIM, and DMARC records, and wait until the domain shows as verified.

  2. Create an API token: My Profile → API Tokens → Create Token → Custom token, with the permission Account → Email Sending → Edit, scoped to your account. Copy the token.

  3. Find your account ID on the account overview page (right sidebar), or in the URL dash.cloudflare.com/<account id>.

  4. Set these variables on Tally and restart:

    MAIL_MAILER=cloudflare
    CLOUDFLARE_ACCOUNT_ID=<account id>
    CLOUDFLARE_EMAIL_TOKEN=<token>
    MAIL_FROM_ADDRESS=no-reply@yourdomain.com
    MAIL_FROM_NAME=Tally

    MAIL_FROM_ADDRESS must be on the domain you onboarded. The flagship instance uses no-reply@tallystats.com.

  5. Test it: sign out and use Forgot your password? on the login page.

The transport calls POST https://api.cloudflare.com/client/v4/accounts/{account_id}/email/sending/send. It retries rate limits (429) and server errors (5xx) up to three times, and turns Cloudflare's error codes into readable errors in the log:

Code Meaning Fix
10101, 10103 Token missing, invalid, or expired Create a token with Email Sending: Edit
10102 Forbidden The token isn't scoped to this account or domain
10105 Not entitled Enable Email Service on the account
10205 Recipient suppressed The address bounced or complained before
10200 Too big Messages are limited to 25 MiB and 50 recipients
10001 Invalid request Usually a MAIL_FROM_ADDRESS on a domain that isn't onboarded

Other providers

The framework's resend (RESEND_API_KEY) and ses (AWS_*, SES_CONFIGURATION_SET) mailers also work: set MAIL_MAILER=resend or ses instead. Any value other than log counts as "email configured".

Templates

Emails are plain HTML with a text alternative, rendered from resources/views/mails/*.html with the framework's mail layout. Links use APP_URL, so set it to your public URL.