Skip to content

[BACKEND] Confirmation email #15

@aleckshen

Description

@aleckshen

Is your feature request related to a problem? Please describe

When a user successfully registers for an event, they receive no confirmation — there is no email sent to acknowledge their registration.

Describe the solution you'd like

Create a reusable sendRegistrationConfirmation function at src/lib/email/registrationConfirmation.ts. Once both this ticket and #12 are merged, the function will be called at the end of the checkCapacity hook after all checks pass.

Function signature:

sendRegistrationConfirmation({
  to: string,
  eventTitle: string,
  eventDate: string,
  eventTime: string,
  eventLocation: string,
})

Email content:

  • Subject: You're registered for {eventTitle}!
  • Body: confirmation message including event title, date, time, and location, signed off as the UOAVC Team

Error handling: wrap payload.sendEmail() in a try/catch — email failures should be logged but must not throw, since a failed email should never block a registration from being saved.

Once both this ticket and Ticket 6 are merged, add the email call to the end of checkCapacity.ts, using req.user?.email for logged-in users or data.guestEmail for guests.

Describe alternatives you've considered

No alternatives considered — a standalone utility function keeps email logic decoupled from the hook and makes it easy to reuse elsewhere (e.g. waitlist confirmations in a future sprint).

Additional context

Depends on email being configured (#11). If email is not yet set up, the function will catch the error, log it, and return gracefully — this is acceptable during development.

Ref: https://payloadcms.com/docs/email/overview

BEFORE MERGING

  • Code generation run (hint: pnpm typegen)
  • PR Reviewed (For non-trivial changes)
  • All required PR checks passing

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature being worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions