mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-01-02 10:58:10 -05:00
1.2 KiB
1.2 KiB
Email Knowledge
Overview
The email module provides React Email components for sending beautiful, responsive emails from the application. We use the React Email for templates and Resend for delivery.
Structure
emails/- Contains all email templates and helper functionsfunctions/- Helper functions for sending emailshelpers.tsx- Core email sending functionssend-email.ts- Low-level email sending utilities
static/- This folder is useless. Includes image assets for the dev preview server.
Usage
Sending Emails
Import the helper functions from the email module to send emails:
import { sendNewEndorsementEmail } from 'email/functions/helpers'
// Example usage
await sendNewEndorsementEmail(privateUser, creator, onUser, text)
Creating New Email Templates
- Create a new React component in the
emails/directory - Use components from
@react-email/componentsfor email-safe HTML - Add preview props
- Export the component as default
- Add a helper function in
functions/helpers.tsxto send the email
Development
You may run typechecks but you don't need to start the email dev server. Assume the human developer is responsible for that.