
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
grunt-postmark
Advanced tools
Send emails through Postmark using GruntJS. You can use this to test your email templates.
This plugin requires that you have a Postmark account.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-postmark --save-dev
After the plugin is installed, it can be enabled in your Gruntfile:
grunt.loadNpmTasks('grunt-postmark');
You'll need to add a config.json and a secrets.json per the mailmason configuration.
Run this task with the grunt postmark command.
Your server token can be found on your server’s credentials page on Postmark’s app.
Type: String
This is the from address you are using to send the email. This must be a confirmed address that's set up on Postmark’s sender signatures.
Type: String
The address you’re sending to.
Type: String
Type: String
grunt.initConfig({
postmark: {
email: {
serverToken: 'POSTMARK_API_TEST',
from: 'you@youremail.com',
to: 'you@youremail.com',
subject: 'Yo',
src: ['test/email.html']
}
}
});
Options specified through a target will always take precedence over global options.
grunt.initConfig({
postmark: {
options: {
serverToken: 'POSTMARK_API_TEST',
from: 'you@youremail.com',
to: 'you@youremail.com',
subject: 'Yo'
},
email: {
to: 'joe@youremail.com',
src: ['test/email.html']
},
digest: {
subject: 'Yo',
src: ['test/email.html', 'test/email2.html']
}
}
});
Run this task with the grunt postmark-templates command.
The postmark-templates task is an alias of the postmark-templates-from-targets task which is itself a two stepped task – postmark-templates-upload followed by postmark-templates-output.
postmark-templates (postmark-templates-from-targets) is intended for programmatic usage from other grunt tasks.
postmark-templates-upload TargetsThe name of your template.
Type: String
The subject line of your template.
Type: String
A path to the generated HTML for your template. Not used if htmlBody is specified.
Type: String
A path to the generated plain text for your template. Not used if textBody is specified.
Type: String
The generated HTML content of your template. Not required if htmlSrc is specified.
Type: String
The generated plain text content of your template. Not required if textSrc is specified.
Type: String
postmark-templates-upload OptionsYour server token can be found on your server’s credentials page on Postmark’s app.
Type: String
This is the name of a temporary grunt task configuration property used to communicate the upload results between postmark-templates-upload and postmark-templates-output without having to write a temporary file. This should be the same value as ephemeralUploadResultsProperty for postmark-templates-output.
Type: String
postmark-templates-output OptionsThe name of a file to output the results of the upload to Postmark.
Type: String
If true, do not export htmlBody, htmlSrc, textBody or textSrc in the specified outputFile.
Type: Boolean
This is the name of a temporary grunt task configuration property used to communicate the upload results between postmark-templates-upload and postmark-templates-output without having to write a temporary file. This should be the same value as ephemeralUploadResultsProperty for postmark-templates-upload.
Type: String
grunt.initConfig({
'postmark-templates-upload': {
options: {
serverToken: 'POSTMARK_API_TEST',
ephemeralUploadResultsProperty: 'temp'
},
test_email: {
name: 'testing-postmark-templates-js1',
subject: 'Testing grunt-postmark-templates',
htmlSrc: 'test/email.html',
textSrc: 'test/email.txt'
},
test_email_inline_body: {
name: 'testing-postmark-templates-js3',
subject: 'Testing grunt-postmark-templates (inline body)',
htmlBody: '<html><body><h1>Another email test</h1></body></html>',
textBody: 'Hello from grunt-postmark-templates\n'
}
},
'postmark-templates-output': {
options: {
cleanOutput: true,
outputFile: 'templates.json',
ephemeralUploadResultsProperty: 'temp'
}
}
});
Run this task with the grunt postmark-templates-from-file command.
The postmark-templates-from-file task invokes the postmark-templates task with targets read from a JSON file (via postmark-templates-parse).
This task is intended for standalone, manual usage.
postmark-templates-parse OptionsThe name of a file that specifies templates for uploading to Postmark. These templates take the same shape as defined by postmark-templates-upload. This should usually be the same value as outputFile for postmark-templates-output.
Type: String
In your Gruntfile:
grunt.initConfig({
'postmark-templates-parse': {
options: {
inputFile: 'templates.json'
}
},
'postmark-templates-upload': {
options: {
serverToken: 'POSTMARK_API_TEST',
ephemeralUploadResultsProperty: 'temp'
}
},
'postmark-templates-output': {
options: {
cleanOutput: true,
outputFile: 'templates.json',
ephemeralUploadResultsProperty: 'temp'
}
}
});
In the file specified by inputFile, in this case, templates.json:
{
"test_email": {
"name": "testing-postmark-templates-js1",
"subject": "Testing grunt-postmark-templates",
"htmlSrc": "test/email.html",
"textSrc": "test/email.txt"
},
"test_email_again": {
"name": "testing-postmark-templates-js2",
"subject": "Testing grunt-postmark-templates (again)",
"htmlSrc": "test/email.html",
"textSrc": "test/email.txt"
},
"test_email_inline_body": {
"name": "testing-postmark-templates-js3",
"subject": "Testing grunt-postmark-templates (inline body)",
"htmlBody": "<html><body><h1>Another email test</h1></body></html>",
"textBody": "Hello from grunt-postmark-templates\n"
}
}
FAQs
Send emails through Postmark using GruntJS
We found that grunt-postmark 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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.