{"library":"postmark","title":"Postmark Node.js Library","description":"The `postmark` package is the official Node.js client library for interacting with the Postmark HTTP API, facilitating robust email sending and parsing capabilities within Node.js applications. It provides high delivery rates, comprehensive bounce and spam processing, and detailed email statistics. The current stable version is 4.0.7, which has recently updated its underlying HTTP client (`axios`). The library sees frequent patch releases to keep dependencies current and make minor model adjustments, with major version increments typically aligned with Node.js End-of-Life (EOL) cycles. Its key differentiators include being an official, actively maintained client with full support for Postmark's REST API, including features for both sending transactional emails and parsing incoming emails.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install postmark"],"cli":null},"imports":["import { ServerClient } from 'postmark';","import { AccountClient } from 'postmark';","import type * as Models from 'postmark/dist/client/models';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { ServerClient } from 'postmark';\n\nconst POSTMARK_SERVER_TOKEN = process.env.POSTMARK_SERVER_TOKEN ?? '';\n\nif (!POSTMARK_SERVER_TOKEN) {\n  console.error('POSTMARK_SERVER_TOKEN environment variable is not set.');\n  process.exit(1);\n}\n\nconst client = new ServerClient(POSTMARK_SERVER_TOKEN);\n\nasync function sendExampleEmail() {\n  try {\n    const response = await client.sendEmail({\n      From: 'sender@example.com',\n      To: 'recipient@example.com',\n      Subject: 'Hello from Postmark.js!',\n      TextBody: 'Hello, this is a test email sent using the official Postmark Node.js library!',\n      HtmlBody: '<html><body><strong>Hello</strong>, this is a test email sent using the official Postmark Node.js library!</body></html>',\n      MessageStream: 'outbound'\n    });\n    console.log('Email sent successfully:', response);\n  } catch (error) {\n    console.error('Failed to send email:', error);\n    if (error instanceof Error) {\n      console.error('Error message:', error.message);\n    }\n  }\n}\n\nsendExampleEmail();","lang":"typescript","description":"Demonstrates how to initialize the Postmark `ServerClient` and send a basic transactional email using environment variables for the API token.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}