-
Notifications
You must be signed in to change notification settings - Fork 33
Getting Started
Getting started with Postmark is very easy.
In order to start using full potential of this library and Postmark API which library is using, you will need to:
- Signup for a new account
- Retrieve a Server API token, from one of the servers you created in your account
- Retrieve an Account API token (optional)
- Create a sender signature
Account API token is needed only for admins, for managing account details like domains, signatures, etc.
To read more about tokens, check out our developer docs.
In order to get to know the library and Postmark, we recommend checking out the following documentation:
- Postmark API reference - to get to know Postmark API, how all the endpoints work
- Postmark JS library documentation (this wiki) - to get to know this client library which is built upon Postmark API
- Postmark JS library codebase documentation - to get to know the library codebase better
Sending email with Postmark is super easy, check out the following code example.
The example shows code in Javascript ES5:
var postmark = require("postmark");
var serverToken = "xxxx-xxxxx-xxxx-xxxxx-xxxxxx";
var client = new postmark.ServerClient(serverToken);
client.sendEmail(
{
From: "igor@activecampaign.com",
To: "igor@activecampaign.com",
Subject: "Hello from Postmark!",
HtmlBody: "Hello message body."
}
, function(err, data) {
console.log(err)
console.log(data) });
Same example using Javascript ES6 code:
import * as postmark from "postmark";
const serverToken = "xxxx-xxxxx-xxxx-xxxxx-xxxxxx";
let client = new postmark.ServerClient(serverToken);
client.sendEmail(
{
From: "igor@example.com",
To: "chris@example.com",
Subject: "Hello from Postmark!",
HtmlBody: "Hello message body."
}
).then(response => {
console.log("Sending message");
console.log(response.To);
console.log(response.Message);
});
Please note that in the code example above you need to change to a server token from your account, and you need to change to a verified signature (from address), you created in your account.
To use the full potential of the library, we recommend using Typescript. Detailed documentation of each library method with additional details about types when using typescript can be found here.
To check out more examples about sending with library, check out email sending section. It should help you going quickly with library usage.
For additional information about the capabilities of the Postmark API, see Postmark Developers Documentation.
- Overview
- Migration from older version
- Getting started
- Email sending
- Bounces
- Templates
- Templates Push
- Server
- Servers
- Message Streams
- Webhooks
- Messages
- Domains
- Sender Signatures
- Stats
- Trigger Inbound Rules
- Suppressions
- Data Removal
- Embedding images in emails
- Error Handling
- Handling Web Hooks
- Mocking requests
- Troubleshooting
- Known issues and how to resolve them