Switching from one electronic mail API supplier to a different will be difficult, so we determined to arrange additional assist. In case you’re switching from Postmark to Elastic Email, this migration information is for you. We gathered all of the important info it is advisable begin utilizing our electronic mail API. Under, you will discover every little thing about our API libraries, learn how to create and arrange your account, and ship your first electronic mail with Elastic Email.
API libraries
To make it simpler so that you can combine with our electronic mail API, we've got ready and continuously preserve downloadable API libraries for 12 programming languages and frameworks. Select one beneath, and you will discover a downloadable API library usually accompanied by guides, authentication directions, some code samples, and different helpful assets.
Listed here are our libraries:
In case you can't discover the library you’re searching for, tell us at [email protected].
How you can get began
Allow us to stroll you thru all of the important steps to arrange your Elastic Email account, combine with our electronic mail API, and begin sending emails.
We additionally ready complete API documentation so that you could combine with our electronic mail API and use it in line with your sending wants. API documentation is the easiest way to see the distinction between electronic mail service suppliers. To simplify issues, we ready a comparability of probably the most important API references for each Elastic Email and Postmark:
Signing up
To get began, join an Elastic Email account right here. Select the Email API product and create your account without cost. No bank card particulars are required. You'll then obtain a affirmation electronic mail to confirm your profile.
Organising a sending area
After creating your Elastic Email account, one of many first steps will likely be so as to add and confirm your sending area. To do it, you will have to arrange the DNS settings of your area. Try our assist article to discover ways to confirm your area step-by-step, or watch our information video beneath:
Creating your API Key
To start out utilizing our electronic mail API, you will have to authenticate your self with an API key. To generate it, enter settings in your Elastic Email account and go to Settings->Handle API Keys->Create.
At this level, you may set customized permissions and non-compulsory entry in your API key.
When you create your API key, maintain it protected as it will likely be used for each API name you make in an effort to determine you and ensure your account’s credentials. You possibly can create as much as 15 API keys.
Your API key needs to be despatched contained in the header with the parameter title ‘x-elasticemail-apikey’ and your API key as a price.
Putting in API library
To make your migration course of simpler and faster, we suggest downloading and putting in a repository of the programming language you employ. Each Postmark and Elastic Email have a big assortment of electronic mail API libraries and SDKs of many programming languages. Similar to you built-in with Postmark’s electronic mail API by putting in a library or SDK, it is advisable do the identical with Elastic Email. All our downloadable repositories can be found on Github.
Let’s present you the set up course of utilizing JavaScript. For instance, while you wish to set up the repository for Node.js.
Npm
To publish the library by way of npm, please observe the process in “Publishing npm packages“.
Then set up it by way of:
npm set up @elasticemail/elasticemail-consumer --save
Sending your first electronic mail
Allow us to first check out what sending an electronic mail by way of Postmark API seems like:
// Require:
var postmark = require("postmark");
// Ship an electronic mail:
var consumer = new postmark.ServerClient("POSTMARK-SERVER-API-TOKEN-HERE");
consumer.sendEmail({
"From": "[email protected]",
"To": "[email protected]",
"Topic": "Take a look at",
"TextBody": "Hello from Postmark!"
});
If you wish to ship your first electronic mail by way of Elastic Email, it is advisable load the library, get consumer occasion, use your newly generated Elastic Email API key, and create an occasion of EmailsApi that will likely be used to ship the e-mail. The 'API_KEY'
for the API key in Postmark is now changed by "YOUR_API_KEY"
.
Based mostly on the JavaScript instance, right here’s the entire code for sending an electronic mail to repeat and paste:
const ElasticEmail = require('@elasticemail/elasticemail-client');
const consumer = ElasticEmail.ApiClient.occasion;
const apikey = consumer.authentications['apikey'];
apikey.apiKey = "YOUR_API_KEY";
const emailsApi = new ElasticEmail.EmailsApi();
const emailData = {
Recipients: [
{
Email: "[email protected]",
Fields: {
name: "John"
}
}
],
Content material: {
Physique: [
{
ContentType: "HTML",
Charset: "utf-8",
Content: "Hi {name}!"
},
{
ContentType: "PlainText",
Charset: "utf-8",
Content: "Hi {name}!"
}
],
From: "[email protected]",
Topic: "Example email"
}
};
const callback = (error, information, response) => {
if (error) {
console.error(error);
} else {
console.log('API known as efficiently.');
console.log('Email despatched.');
}
};
emailsApi.emailsPost(emailData, callback);
Email API Migration information: wrapping up
We hope after studying this migration information, you now have all of the vital info and assets essential to make the swap and combine with our electronic mail API. In case you have any questions or want extra help, our buyer help knowledgeable will likely be pleased that will help you from day one. They're obtainable to you 24/7 by way of electronic mail at [email protected] or by way of reside chat, which you'll find within the backside proper nook of our web site and platform.
Haven’t you signed up for an Elastic Email account? Strive it out and begin sending emails with us at this time!
Source link