-
Notifications
You must be signed in to change notification settings - Fork 7
Getting Started
Dan Sabin edited this page Jun 8, 2026
·
1 revision
npm install inline-emailInline Email v3 targets Node.js 20 and newer.
Compile templates at build time, deploy time, or application startup:
const { compileEmailTemplate } = require('inline-email');
const compiled = await compileEmailTemplate({
subject: 'Welcome to ACME, {{firstName}}',
html,
css,
text: 'Welcome to ACME, {{firstName}}'
});Render dynamic data when the email is sent:
const email = compiled.render({
data: {
firstName: 'Dan',
appUrl: 'https://app.example.com'
}
});
// email.subject
// email.html
// email.textFor simple workflows:
const { renderEmail } = require('inline-email');
const email = await renderEmail({
template: {
subject: 'Welcome, {{firstName}}',
html: '<p>Hello {{firstName}}</p>'
},
data: {
firstName: 'Dan'
}
});inline-email input.html
inline-email input.html --out output.html
inline-email --css style.css input.htmlSupported options:
--html <file> Input HTML file. A positional input file is also supported.
--css <files...> CSS files to inline.
--out, -o <file> Write output to a file instead of stdout.
--noInlineImages Disable image web resource inlining.
--force, -f Overwrite the output file.
--help, -h Show help text.
npm run examplesThen open examples/out/index.html.
Inline Email is maintained by Freethinking IT.