Emails
Which emails events send, who gets them, and how they reach the inbox.
Events send an email whenever something changes for a person. The website never sends email itself: it leaves a note in a queue, and a small separate program sends it.
Who gets what
| Who gets it | When | |
|---|---|---|
| You're going | the person | they join, accept an invitation or get approved |
| Someone joined | the organizer | a person joins |
| Someone asked to join | the organizer | a person asks or joins the waitlist |
| You're invited | the invited address | the organizer invites them |
| Event changed | everyone going | the time, place, format or meeting link changes |
| Event cancelled | everyone going, waiting or asking | the event is cancelled |
| Not approved, or place removed | the person | the organizer declines them |
Each person gets their own copy, so nobody sees anyone else's address. Times in emails use the event's own time zone.
How an email is sent
The change and its email are saved together. If the change fails, no email goes out.
The website wakes the worker. If that call is missed, the worker still checks every hour.
The worker sends the email, retrying a failed one after 30 seconds, 2 minutes, 8 minutes and 32 minutes.
Good to know
- There is a daily sending limit. Emails over it wait until the next day.
- The meeting link is never written in an email. People find it on the event page.
- Drafts never send email.
- Reminders before an event starts are not built yet.
- The API inserts an
emailjob intojobsin the same transaction as the change (a transactional outbox), then calls the worker'sPOST /wakewith a bearer secret. - The Go worker claims due jobs with
FOR UPDATE SKIP LOCKED, sends batches of up to 100 through Resend with the job id as an idempotency key, and marks a jobdeadafter 5 attempts. - The worker sends real email only when
APP_ENV=production; otherwise it logs and drops. Its daily cap isEMAIL_DAILY_CAP. - Done jobs are deleted after 7 days and dead jobs after 30. Details: Background jobs.
| Piece | Where |
|---|---|
| Email wording | mailer.ts |
| What triggers each email | event.notifications.ts |
| Queue and wake | job.service.ts |
| Worker | apps/worker/ |