Switching from one email API provider to another can be challenging, so we decided to prepare extra help. If you’re switching from Postmark to Elastic Email, this migration guide is for you. We gathered all the essential information you need to start using our email API. Below, you will find everything about our API libraries, how to create and set up your account, and send your first email with Elastic Email.
API libraries
To make it easier for you to integrate with our email API, we have prepared and constantly maintain downloadable API libraries for 12 programming languages and frameworks. Choose one below, and you will find a downloadable API library often accompanied by guides, authentication instructions, some code samples, and other useful resources.
Here are our libraries:
If you cannot find the library you’re looking for, let us know at contact@elasticemail.com.
How to get started
Let us walk you through all the essential steps to set up your Elastic Email account, integrate with our email API, and start sending emails.
We also prepared comprehensive API documentation so that you can integrate with our email API and use it according to your sending needs. Looking at API documentation is the best way to see the difference between email service providers. To simplify matters, we prepared a comparison of the most essential API references for both Elastic Email and Postmark:
API Name |
||
Introduction |
Introduction | Overview |
Authentication |
Authentication | Authentication |
Sending Emails |
Emails | |
Managing Suppressions |
Suppressions | Suppressions |
Managing Templates |
Templates | Templates |
Inbound Email Processing |
Inbound Route | Messages |
Statistics |
Statistics | Stats |
Signing up
To get started, sign up for an Elastic Email account here. Choose the Email API product and create your account for free. No credit card details are required. You will then receive a confirmation email to verify your profile.
Setting up a sending domain
After creating your Elastic Email account, one of the first steps will be to add and verify your sending domain. To do it, you will need to set up the DNS settings of your domain. Check out our help article to learn how to verify your domain step-by-step, or watch our guide video below:
Creating your API Key
To start using our email API, you will need to authenticate yourself with an API key. To generate it, enter settings on your Elastic Email account and go to Settings->Manage API Keys->Create.
![](https://cms.elasticemail.com/wp-content/uploads/2024/06/migration-guide-API-screenshot-1.png)
At this point, you can set custom permissions and optional access for your API key.
![](https://cms.elasticemail.com/wp-content/uploads/2024/06/migration-guide-API-screenshot-2.png)
Once you create your API key, keep it safe as it will be used for every API call you make in order to identify you and confirm your account’s credentials. You can create up to 15 API keys.
Your API key should be sent inside the header with the parameter name ‘x-elasticemail-apikey’ and your API key as a value.
Installing API library
To make your migration process easier and quicker, we recommend downloading and installing a repository of the programming language you use. Both Postmark and Elastic Email have a large collection of email API libraries and SDKs of many programming languages. Just like you integrated with Postmark’s email API by installing a library or SDK, you need to do the same with Elastic Email. All our downloadable repositories are available on Github.
Let’s show you the installation process using JavaScript. For example, when you want to install the repository for Node.js.
Npm
To publish the library via npm, please follow the procedure in "Publishing npm packages".
Then install it via:
npm install @elasticemail/elasticemail-client --save
Sending your first email
Let us first take a look at what sending an email via Postmark API looks like:
// Require:
var postmark = require("postmark");
// Send an email:
var client = new postmark.ServerClient("POSTMARK-SERVER-API-TOKEN-HERE");
client.sendEmail({
"From": "sender@example.com",
"To": "recipient@example.com",
"Subject": "Test",
"TextBody": "Hello from Postmark!"
});
If you want to send your first email via Elastic Email, you need to load the library, get client instance, use your newly generated Elastic Email API key, and create an instance of EmailsApi that will be used to send the email. The 'API_KEY'
for the API key in Postmark is now replaced by "YOUR_API_KEY"
.
Based on the JavaScript example, here’s the whole code for sending an email to copy and paste:
const ElasticEmail = require('@elasticemail/elasticemail-client');
const client = ElasticEmail.ApiClient.instance;
const apikey = client.authentications['apikey'];
apikey.apiKey = "YOUR_API_KEY";
const emailsApi = new ElasticEmail.EmailsApi();
const emailData = {
Recipients: [
{
Email: "johnsmith@domain.com",
Fields: {
name: "John"
}
}
],
Content: {
Body: [
{
ContentType: "HTML",
Charset: "utf-8",
Content: "<strong>Hi {name}!<strong>"
},
{
ContentType: "PlainText",
Charset: "utf-8",
Content: "Hi {name}!"
}
],
From: "myemail@domain.com",
Subject: "Example email"
}
};
const callback = (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
console.log('Email sent.');
}
};
emailsApi.emailsPost(emailData, callback);
Email API Migration guide: wrapping up
We hope after reading this migration guide, you now have all the important information and resources necessary to make the switch and integrate with our email API. If you have any questions or need additional assistance, our customer support expert will be happy to help you from day one. They are available to you 24/7 via email at support@elasticemail.com or via live chat, which you can find in the bottom right corner of our website and platform.
Haven’t you signed up for an Elastic Email account? Try it out and start sending emails with us today!