
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
@uscreen.de/postal-mailer
Advanced tools
Mailer engine using mjml templates to send mail via postal api or smtp
Mailer engine using mjml templates to send mail via postal api or smtp
$ yarn add @uscreen.de/postal-mailer # or use npm -i
const mailer = require('@uscreen.de/postal-mailer')({
// load config defaults from .env file (defaults to false)
useDotenv: true,
// override with inline options if needed
postalSender: 'domains+noreply@postal-stage.uscreen.net'
})
const result = await mailer
.sendMail({
data,
template: 'test',
to: 'rcpt@example.com',
subject: 'Example Test Mail'
})
.then(r => {
console.log('RESULT:', r)
})
.catch(e => {
console.error('ERROR sending mail:', e)
})
Please refer to https://mjml.io and https://handlebarsjs.com. Start with example like so:
<mjml>
<mj-head>
<mj-title>Test Mail</mj-title>
<mj-attributes>
<mj-all font-family="BlinkMacSystemFont, -apple-system, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;"></mj-all>
<mj-text font-weight="300" font-size="16px" color="#000000" line-height="24px"></mj-text>
</mj-attributes>
</mj-head>
<mj-body background-color="#F2F2F2">
<mj-section background-color="#ff781e" padding="20px">
<mj-column width="100%">
<mj-text align="center" font-size="24px" color="#ffffff" font-weight="600">
A very simple Test E-Mail
</mj-text>
</mj-column>
</mj-section>
<mj-section background-color="#FFFFFF" padding="40px 20px">
<mj-column width="100%">
<mj-text>
Greetings {{user.firstName}} {{user.lastName}},<br>
<br>
this is a simple example on how to setup a template and pass in some data.
</mj-text>
<mj-text>
template will prefix all asset urls (ie. imgages) with<br>"{{postalAssetsUrl}}"
</mj-text>
</mj-column>
</mj-section>
<mj-section padding="0px 0 20px 0">
<mj-column>
<mj-text align="center" color="#9B9B9B" font-size="11px">ACME Inc, Street. 1, 12345 City</mj-text>
</mj-column>
</mj-section>
</mj-body>
</mjml>
which renders to something like this:

To reduce repetition in your email templates, you can use the layout inheritance system. This allows you to define a base layout with common elements (header, footer, styles) and only write the unique content for each email.
Create a layout file in a layouts subdirectory within your template locale folder:
<!-- templates/en/layouts/base.mjml -->
<mjml>
<mj-head>
<mj-title>{{title}}</mj-title>
<mj-preview>{{preview}}</mj-preview>
<mj-attributes>
<mj-all font-family="Arial, sans-serif" />
</mj-attributes>
<mj-style>
/* Common styles */
{{#if customStyles}}{{{customStyles}}}{{/if}}
</mj-style>
</mj-head>
<mj-body>
<!-- Common header -->
<mj-section>
<mj-column>
<mj-text>{{companyName}}</mj-text>
</mj-column>
</mj-section>
<!-- Main content -->
{{{content}}}
<!-- Common footer -->
{{#unless hideFooter}}
<mj-section>
<mj-column>
<mj-text>© 2024 {{companyName}}</mj-text>
</mj-column>
</mj-section>
{{/unless}}
</mj-body>
</mjml>
To use a layout in your template, add a front matter section at the top:
<!-- templates/en/welcome.mjml -->
<!-- @meta
layout: base.mjml
title: "Welcome to Our Service"
preview: "Get started with your new account"
-->
<!-- @styles -->
.highlight { color: #ff6600; }
<!-- @endstyles -->
<!-- @content -->
<mj-section>
<mj-column>
<mj-text>
Welcome {{user.firstName}}!
</mj-text>
<mj-text css-class="highlight">
Your account is ready to use.
</mj-text>
</mj-column>
</mj-section>
<!-- @endcontent -->
@meta - Front matter section containing layout and variables
layout: - Specifies which layout file to use (relative to the layouts directory)@styles / @endstyles - Adds custom CSS styles to the layout@content / @endcontent - Wraps the main content of your emailAll template data passed to sendMail() is also available in the layout.
All options can be managed via .env file and/or inline configuration as seen above. Overview of options:
| option | Description | Default | Example |
|---|---|---|---|
| useDotenv | whether to also read options from .env files | false | true |
| postalTransport | Send mail via Postal API or SMTP | postal | smtp |
| postalServer | Postal Server Host | postal.example.com | |
| postalPort | If sending via SMTP, the SMTP port | 25 | 25 |
| postalUser | If sending via SMTP, the SMTP username | acme/my-api | |
| postalKey | If sending via Postal API, the API Key to use. If sending via SMTP, the SMTP password | ExAmPlE_key | |
| postalSender | From Address in emails | noreply@example.com | |
| postalTemplates | path to directory containing email templates | <cwd>/templates | ./templates/mails |
| postalAssetsUrl | url to prefix assets | '' | https://www.example.com/mail/assets |
| postalDefaultLocale | when set, locales will default to 'en' and templates will default ./templates/en instead of ./templates | '' | 'en' |
Send a template rendered with data to a recepient with a subject.
(In an optional language set by locale)
subject)FAQs
Mailer engine using mjml templates to send mail via postal api or smtp
The npm package @uscreen.de/postal-mailer receives a total of 7 weekly downloads. As such, @uscreen.de/postal-mailer popularity was classified as not popular.
We found that @uscreen.de/postal-mailer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers 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.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.