calcom/cal.com
emails
Purpose
packages/emails holds the transactional email templates for Cal.diy. Booking confirmations, reschedule notices, cancellation notices, daily digests, payment receipts, password reset emails, magic-link emails, and team invitations all live here.
Directory layout
The package is rendered from React components (the project uses React Email–style JSX templates that compile to HTML + plain text).
packages/emails/
├── src/
│ ├── components/ # Shared layout primitives (header, footer, button)
│ ├── templates/ # One file per template
│ ├── i18n/ # i18n hooks for emails
│ ├── lib/ # Helpers (BOOKER_URL, calendar attachment builder, ...)
│ └── ...
├── package.json
└── tsconfig.jsonSending pipeline
Email sending in Cal.diy is split:
- Render — a service composes a React template (e.g.,
AttendeeScheduledEmail) and renders it to HTML + plain text. - Send —
packages/lib/Sendgrid.ts(and SMTP fallback) actually transmits. The provider is selected by env vars (EMAIL_FROM,EMAIL_SERVER_*, or SendGrid API key). - Defer — for non-urgent mail, the booking pipeline enqueues a tasker job (
packages/features/tasker) instead of sending inline. - Reminder cadence — the GitHub Actions cron
cron-bookingReminder.yml,cron-scheduleEmailReminders.yml,cron-monthlyDigestEmail.ymlpoke endpoints that drain queued reminders.
Conventions
- Templates pull copy through
packages/i18n/locales/<locale>/common.jsonso users see localized emails. The default locale isen. - Reply-to behavior is centralized in
packages/lib/getReplyToEmail.tsandpackages/lib/getReplyToHeader.ts— these handle the case where attendees should reply to the organizer instead of the no-reply mailbox. - Test-only deliveries go through
packages/lib/testEmails.ts(usesmailhogin CI; configured invitest-mocks/).
Integration points
- Booking pipeline — every transition emits at least one email. See
packages/features/bookings/lib/handleNewBooking/,handleConfirmation/,handleCancelBooking/. - Workflows / reminders — even with the EE workflow runtime being deprecated, basic reminders still flow through tasker → email.
- NextAuth — magic-link / verification / password-reset emails are sent here.
Entry points for modification
- Add a template: drop a new file under
packages/emails/src/templates/, expose a render function, hook it into the relevant booking step or trigger. - Change brand: edit the shared components (header, footer, colors) under
packages/emails/src/components/. - Localize: add the new key to
packages/i18n/locales/en/common.json(and ideally other locales) and reference it from the template.
Related pages
- features → bookings — the largest emitter
- tooling — Sendgrid + SMTP wiring
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.