Introduction
JCC Express MVC provides a Laravel-style mail API with:
Mailfacade (jcc-express-mvc/lib/Mail)Mailablebase classEnvelope,Address,Content, andAttachment- Driver manager (
NodemailerorResend, based onMAIL_DRIVER)
Quick send with Mail
TypeScript
Mail.to(...).cc(...).bcc(...).send(...) builds a payload and routes it through MailManager.
Sending a Mailable class
Use Mailable for reusable templates and metadata:
TypeScript
Send it:
TypeScript
Attachments
The Attachment helper supports path, storage, and in-memory data:
TypeScript
Driver selection
MailManager chooses the driver from MAIL_DRIVER:
resend-> Resend driver- anything else (
smtp,mailtrap, etc.) -> Nodemailer driver
Related env values used by drivers include:
MAIL_DRIVERMAIL_HOST,MAIL_PORT,MAIL_USERNAME,MAIL_PASSWORDMAIL_FROM_ADDRESS,MAIL_FROM_NAMERESEND_API_KEY(orMAIL_API_KEYfallback)
Rendering behavior
- If
contentisContent, it compiles with itsviewandwithdata. - If
contentis a string, it is treated as a view/template path and compiled. subject, recipients, cc/bcc, and attachments are then passed to the active driver.
Summary
- Use
Mail.to(...).send(...)for simple emails. - Use
Mailable+Envelope+Contentfor reusable classes. - Use
Attachmentfor files/data payloads. - Driver is selected automatically by
MAIL_DRIVER.
