
Company News
Meet the Socket Team at RSAC and BSidesSF 2026
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.
ms-mailer-templates
Advanced tools
Uses foundation ink by zurb for creating basic responsive styles. By default includes the most simple templates for account activation and password reset.
npm i ms-mailer-templates -S
const render = require('ms-mailer-templates');
const ctx = { link: 'http://localhost', qs: '?token=xxxxx', username: 'Indiana Johns' };
render('activate', ctx, optionalHandlebarsOpts )
.then(template => {
// get rendered template
});
It checks for incorrect context, missing template and so on
The package uses i18next library to provide translations.
Provide lng option among other context options to specify destination language when rendering templates.
The following code will return html for activate email template translated into german.
const render = require('ms-mailer-templates');
render('activate', { lng: 'de' })
.then(translatedTemplate => {
...
});
Package exports a simple translation helper as a property of the default export.
render.translate(key, { lng, ...rest });
Where key is the key of the string to be translated, lng - target language, rest - other translation context options
Usage example:
const render = require('ms-mailer-templates');
// returns translated string when translation is available
// for 'de' language and 'custom' namespace
const txt = render.translate('custom:|Count {{count}}', { lng: 'de', count: 10 });
To add i18n support for existing or new templates one must wrap strings to be translated into t handlebars helper.
<div>
{{t "String to translate"}}
</div>
Default package's i18n namespace is emails. All strings fall into this namespace unless
specifically stated otherwise. When one has separate translation project they
can put their own strings into separate namespace. :| works as the namespace
separator.
<span>{{t "my-own-ns:|something to be translated"}}</span>
Then add your newly created namespace to the list of supported namespaces in src/i18n.js file:
const SUPPORTED_NAMESPACES = [
'emails',
'your-new-namespace',
...
]
The package uses en locale as a reference and fallbacks to the key contents when no translation is provided.
All strings wrapped with t helper will be parsed into en locale.
Command
yarn i18n:parse
will parse all src/templates/**/*.html files and store all collected strings under
i18n-parsed directory with structure as follows:
...
└──i18n-parsed
└──en
├── emails.json
└── custom-namespace.json
All translated resources must be provided as flat json files under i18n directory
following the i18n/{{language}}{{namespace}}.json filename template.
...
└──i18n
├──en
│ ├── emails.json
│ └── custom-namespace.json
├──de
│ ├── emails.json
│ └── custom-namespace.json
│ ...
passwordresetactivateinvitereport-problemrequest-invitesupport-contactaccept-inviteadd-member-notifyfeedbackregistration-notifypassword-resetFAQs
Templates for mailer microservice
We found that ms-mailer-templates demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.

Research
/Security News
Malicious Packagist packages disguised as Laravel utilities install an encrypted PHP RAT via Composer dependencies, enabling remote access and C2 callbacks.

Research
/Security News
OpenVSX releases of Aqua Trivy 1.8.12 and 1.8.13 contained injected natural-language prompts that abuse local AI coding agents for system inspection and potential data exfiltration.