JCC Express

Email Verification

Introduction

JCC Express MVC ships a verification-email sending flow through auth events/listeners:

  • Event: Registered (jcc-express-mvc/lib/Auth/Event/Registered.ts)
  • Listener: SendEmail (jcc-express-mvc/lib/Auth/Listener/SendEmail.ts)

When the Registered event is emitted with a user payload, SendEmail sends an email using the Mail system.


How the built-in listener works

SendEmail.handle(event):

  • reads event.user.email
  • validates basic email shape
  • builds URL:

- ${APP_URL}/verify-email/${encodeURIComponent(email)}

  • sends templated mail via:

- view: views.email.verification - subject: Email Verification - message: Click the link to verify your email

If email is missing/invalid, it logs a warning and skips sending.


Trigger verification email

Emit Registered after user signup:

TypeScript

This uses the framework event pipeline and registered listeners.


Required pieces in your app

To complete verification end-to-end, your app should provide:

  • A mail view template at views.email.verification
  • A verification route/handler for /verify-email/:email (or your custom URL)
  • User model/database field updates (for example email_verified_at)

The framework listener sends the email link, but actual verification endpoint logic is application-defined.


Typical app-side flow:

  1. Validate link/token/signature
  2. Resolve user
  3. Mark verified timestamp/flag
  4. Redirect with success/error message

If you need stronger security, prefer signed, expiring verification tokens instead of a plain encoded email in URL.


Mail driver and config

Verification delivery relies on Mail config (MAIL_DRIVER, SMTP or Resend settings, sender defaults). See Digging Deeper/Mail.md for full details.


Summary

  • Use emit(new Registered(user)) to trigger verification mail.
  • Built-in SendEmail composes and sends verification email using Mail.
  • Implement the actual /verify-email/... handler in your application.