How to create and send through Message Streams

The ability to add additional Message Streams is currently in a closed beta. To learn more about Message Streams and get notified when this launches sign up here.

Adding additional Message Streams in your Postmark account allows you to add new Transactional or Broadcast Message Streams, letting you to send all of your application emails through Postmark.

Transactional Message Streams are for messages triggered by a user action, for instance, a password reset or shipping notification. Broadcast Message Streams are messages your application sends to many recipients at once, for instance, a Terms of Service change notification.

Broadcast Message Streams use a separate infrastructure to maintain our high deliverability with Transactional messages.

Creating a Message Stream

  1. Choose the Server that you’d like to add a new Message Stream to.
  2. Choose Create Message Stream.
  3. On the form, fill out the name of the Message Stream and the type of Stream.
  4. Then select Create Message Stream which will add the Stream to your Server.

Sending through a Message Stream

To send with a new Message Stream, Postmark has introduced a Stream ID, which is specified at the time of sending. The Stream ID is found on the top right when viewing a Stream. If no Stream ID is provided when sending, Postmark will send through the default Transactional Stream.

The Stream ID is found on the top right when viewing a Stream

API

To send through Postmark’s API, it’s an additional parameter when sending an email with the “MessageSteam” parameter. This is the Stream ID.

Send a single email JSON Body:

{
 "From": "sender@example.com",
 "To": "receiver@example.com",
 "Subject": "Hello from Postmark",
 "Tag": "TestEmail",
 "HtmlBody": "<strong>Hello</strong> dear Postmark user.",
 "TextBody": "Hello dear Postmark user.",
 "MessageStream": "broadcasts"
}

Example single email request with cURL:

curl "https://api.postmarkapp.com/email" \
 -X POST \
 -H "Accept: application/json" \
 -H "Content-Type: application/json" \
 -H "X-Postmark-Server-Token: server token" \
 -d "{From: 'sender@example.com', To: 'receiver@example.com', Subject: 'Hello from Postmark', Tag: 'TestEmail', HtmlBody: '<strong>Hello</strong> dear Postmark user.', TextBody: 'Hello dear Postmark user.', MessageStream: 'broadcasts'}"

Send with Templates JSON Body:

{
 "From": "sender@example.com",
 "To": "recipient@example.com",
 "TemplateAlias": "welcome",
 "TemplateModel": {
 "user_name": "John Smith"
 },
 "MessageStream": "broadcasts"
}

Send with Template request with cURL:

curl "https://api.postmarkapp.com/email/withTemplate" \
 -X POST \
 -H "Accept: application/json" \
 -H "Content-Type: application/json" \
 -H "X-Postmark-Server-Token: server token" \
 -d '{
 "From": "sender@example.com",
 "To": "recipient@example.com",
 "TemplateAlias": "welcome",
 "TemplateModel": {
 "user_name": "John Smith"
 },
 "MessageStream": "broadcasts"
}'

SMTP

To send with Broadcast Message Streams via SMTP, it requires the ability to add additional Headers with your SMTP client. The X-PM-Message-Stream header is your Broadcast Message Stream ID.

Server: smtp-broadcasts.postmarkapp.com
Ports: 25, 2525, or 587
Username: server token
Password: server token
Authentication: Plain text, CRAM-MD5, or TLS
Header: X-PM-Message-Stream: broadcasts

Note: Broadcast Message Streams use a different server URL than Transactional Streams.

Last updated June 16th, 2020

Still need some help?

Our customer success team has your back!