Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Node.JS module to send email with PostageApp API
tree: 93c34229e8

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

PostageApp for Node.JS

This is a module for Node.JS that allows you to send emails with PostageApp service. Personalized transactional email sending can be offloaded to PostageApp via the JSON based API.

API DocumentationPostageApp FAQsPostageApp Help Portal


Node Package Manager

In your app directory type npm install postageapp


GIT Submodule

In your app directory type:

git submodule add plugins/postage
git submodule init
git submodule update

GIT Clone

In your node_modules directory type

git clone postage


When you require the library, make sure to specify your API key:

var postageapp = require('postageapp')('YOUR API KEY HERE');

After that, you should be good to go. Load the module in your app and call the apiCall function. Here is a sample of how to use it:

var postageapp = require('postageapp')('YOUR API KEY HERE');
postageapp.apiCall(recipients, content, subject, from, variables);

Recipients can be passed along as a single string or as an array.

recipients = "";
recipients = ["", ""];

If you wish to set Message Variables for each individual recipient, you just have to pass an array for each recipient.

recipients = {
    "": {
        'variable': 'Value'
    "": {
        'variable': 'Another Value'

Content will accept an array for HTML and plain text content. If it is a string, it will assume that you are naming a template.

content = {
    'text/html': '<strong>Sample bold content.</strong>',
    'text/plain': 'Plain text goes here'
content = 'TEMPLATE_NAME';

Subject and from can be simple strings.

subject = 'Subject Title';
from = '';

If you are using a template name with defined subject and from values, just set these to null.

subject = null;
from = null;

Message Variables needs to have an array passed into it with the variable names and values.

variables = {
    'variable': 'Variable value',
    'variable2': 'Another variable'

For more information about formatting of recipients, templates and variables please see the PostageApp documentation.

Something went wrong with that request. Please try again.