@ecfjs/mail
v1.0.0-rc.3
Published
ECF mail system with Resend REST API, SMTP transport, Mailable classes, queued delivery, and template rendering
Maintainers
Readme
@ecfjs/mail — Enterprise Mail & Communication Platform
@ecfjs/mail is the official mail and communication platform for the ECF (Enterprise Core Framework) ecosystem.
Features
- ✉️ Multi-Transport Engine: Memory, Log, Null, SMTP, Resend, Mailgun, Failover, LoadBalancer.
- 🎨 Markdown & Automatic CSS Inlining: Markdown template compilation with automatic inline CSS generation for HTML email clients.
- 📎 Attachments & CID Images: Attachments from
@ecfjs/storagedisks, Buffer, Stream, or Path. Embedded Content-ID (cid:key) images. - 🔄 Background Queue Integration: Asynchronous email delivery via
@ecfjs/queue(mailable.queue()). - 🧪 Mail Testing Fake:
Mail.fake(),assertSent(),assertQueued(),assertSentTo(). - 🖥️ Sandbox Preview Server:
MailSandboxServerfor local email previewing during development.
Quick Start
1. Creating a Mailable
import { Mailable } from "@ecfjs/mail";
export class WelcomeUserMail extends Mailable {
constructor(userName) {
super();
this.subject("Welcome to ECF Framework!");
this.markdown("emails.welcome", { userName });
}
}
// Send mail immediately
await Mail.to("[email protected]").send(new WelcomeUserMail("Waseem"));
// Queue mail in background
await Mail.to("[email protected]").queue(new WelcomeUserMail("Waseem"));2. Testing Fake
import { Mail } from "@ecfjs/mail";
const fakeMail = Mail.fake();
await Mail.to("[email protected]").send(new WelcomeUserMail("Waseem"));
fakeMail.assertSent(WelcomeUserMail);License
MIT
