Registry / messaging / postmarkapi

postmarkapi

JSON →
library0.0.7jsnpmunverified

A full REST API wrapper for Postmark (email delivery service) version 0.0.7, targeting Node.js >=0.10.20. This library provides a simple callback-based interface for sending emails, managing bounces, and retrieving outbound/inbound messages via the Postmark API. It is not actively maintained; the last release is from 2014, and it uses deprecated `request` module under the hood. Modern alternatives include the official `postmark` npm package which supports promises, async/await, and better error handling.

npm install postmarkapi
INSTALL
IMPORT
SIG · POSTMARKAPI
P
postmarkapi
messagingjavascriptv0.0.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

postmarkapi
const PostmarkAPI = require('postmarkapi');
import PostmarkAPI from 'postmarkapi';
The package is CommonJS-only (no ESM exports) and predates ES modules. Use require or dynamic import().
PostmarkAPI
const pmk = new PostmarkAPI('server-token');
const pmk = new PostmarkAPI.default('server-token');
The constructor is exported directly as module.exports, not as a named export.
pmk.email()
pmk.email({...}, callback);
pmk.email({...}).then();
The library uses callbacks only; no Promise or async/await support. Attempting to .then() will result in a TypeError.

Sends a simple email using the Postmark API with a server token from environment variable.

const PostmarkAPI = require('postmarkapi'); const pmk = new PostmarkAPI(process.env.POSTMARK_SERVER_TOKEN ?? ''); pmk.email({ to: 'recipient@example.com', from: 'sender@example.com', subject: 'Hello from Postmark API', text: 'This is a test email.' }, function(err, response) { if (err) console.error('Error:', err); else console.log('Email sent:', response); });
Debug
Known issues
deprecatedPackage is unmaintained since 2014. Use the official 'postmark' npm package instead.
fix
npm install postmark
affects: >=0.0.1
breakingThe 'request' dependency is deprecated and may cause security warnings. Node versions >= 10 may have compatibility issues.
fix
Use the official postmark package which uses modern HTTP clients.
affects: >=0.0.1
gotchaThe library does not support promises or async/await; all operations require callbacks.
fix
Wrap calls in a Promise or use the official postmark package that supports promises.
affects: >=0.0.1
gotchaAttachments can be passed either as file paths or objects with name, content (base64), contentType. Using a path string requires the file to exist on disk.
fix
Ensure file paths are absolute or relative to process.cwd(). Prefer object format with pre-loaded content.
affects: >=0.0.1
gotchaThe 'cc' field accepts an array or string; 'bcc' accepts array or string as well. Using a single string without wrapping in array works but may cause confusion.
fix
Always pass arrays for cc and bcc for consistency.
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'request'
Missing 'request' dependency when installing in older npm versions or using npm dedupe.
fix
Explicitly install 'request': npm install request
TypeError: PostmarkAPI is not a constructor
Attempting to use import syntax (ES modules) with this CommonJS module.
fix
Use require('postmarkapi') or dynamic import().
Error: Invalid API token
Server token is missing, empty, or invalid.
fix
Provide a valid Postmark server token from your Postmark account.
Upgrade
Version history
0.0.7latest on npm
Audit
Dependencies
requestrequiredHTTP client for API calls
Agent activity
16 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
postmarkapi — npm install postmarkapi · libregistry