MJML + Better-Notify
Write responsive email templates in MJML markup and render them through Better-Notify. MJML compiles to bulletproof HTML that works across every email client.
Install
npm install @betternotify/mjmlQuick start
import { mjmlTemplate } from '@betternotify/mjml';
const catalog = rpc.catalog({
receipt: rpc
.email()
.input(z.object({ amount: z.number(), orderId: z.string() }))
.subject(({ input }) => `Receipt for order ${input.orderId}`)
.template(mjmlTemplate(`<mjml>
<mj-body>
<mj-section>
<mj-column>
<mj-text>Receipt for order {{orderId}} — ${{amount}}</mj-text>
</mj-column>
</mj-section>
</mj-body>
</mjml>`)),
});Features
- MJML responsive email markup
- Cross-client compatible output
- Handlebars variable interpolation
- Type-safe template bindings
- Works with any email transport