Setting Up
Created a Postmark account and validated the “Sender Signature” (the email address of sender) 2. Options for multiple servers (for different projects if necessary)
3. Retrieved API Token for the server
Testing API
Use API Token in Request Header
Single Email Call
API call for sending single email
Request Body for simple test email
{
"From": "bmo@lumafintech.com",
"To": "bmo@lumafintech.com",
"Subject": "Test",
"Tag": "Invitation",
"HtmlBody": "<html><body><strong>Hello</strong> dear Postmark user.</body></html>",
"TextBody": "Hello dear Postmark us.",
"MessageStream": "outbound"
}
Response
{
"To": "bmo@lumafintech.com",
"SubmittedAt": "2023-02-08T15:48:34.261355Z",
"MessageID": "1d743915-e0aa-448d-a8e2-636456951d7c",
"ErrorCode": 0,
"Message": "OK"
}
Batch Email Call
API call for sending a batch of emails (Up to 500 emails per batch)
Request Body (Array of email requests)
[
{
"From": "bmo@lumafintech.com",
"To": "bmo@lumafintech.com",
"Subject": "Postmark test #1",
"TextBody": "Hello dear Postmark user.",
"HtmlBody": "<html><body><strong>Hello</strong> dear Postmark user.</body></html>",
"MessageStream": "outbound"
},
{
"From": "bmo@lumafintech.com",
"To": "bmo@lumafintech.com",
"Subject": "Postmark test #2",
"TextBody": "Hello dear Postmark user.",
"HtmlBody": "<html><body><strong>Hello</strong> dear Postmark user.</body></html>",
"MessageStream": "outbound"
}
]
Other
Attachments can be sent in request body by encoding the content from binary to base64 {
"From": "bmo@lumafintech.com",
"To": "bmo@lumafintech.com",
"Subject": "Postmark test #2",
"TextBody": "Hello dear Postmark user.",
"HtmlBody": "<html><body><strong>Hello</strong> dear Postmark user.</body></html>",
"MessageStream": "outbound",
"Attachments": [
{
"Name": "readme.txt",
"Content": "dGVzdCBjb250ZW50",
"ContentType": "text/plain"
},
{
"Name": "report.pdf",
"Content": "dGVzdCBjb250ZW50",
"ContentType": "application/octet-stream"
}
]
}
Java Library is also available for Postmark for simple API integration
Other useful functionalities are available, such as link-tracking, webhooks, etc.
link-tracking:
webhooks: