When you’ve determined to transfer from MailerSend to Elastic Email, congratulations! Welcome onboard and we glance ahead to serving to you migrate from one e-mail API to one other. We ready this e-mail API migration information so that you just get all the knowledge you want to begin utilizing our product. On this article, you will see the whole lot about our API libraries and documentation, how to get began and ship your first e-mail with Elastic Email.
API libraries
To make it simpler for you to combine with our e-mail API, we have now ready and always preserve downloadable API libraries for 12 programming languages and frameworks. They're usually accompanied by guides for authentication, code samples, and different helpful assets. Listed here are our libraries:
When you can't discover the library you’re on the lookout for, tell us at [email protected].
How to get began
Now it’s time to stroll you thru all of the important steps to arrange your Elastic Email account, combine with our e-mail API, and begin sending emails.
We additionally ready complete API documentation so to combine with our e-mail API and use it in accordance to your sending wants. Taking a look at API documentation is one of the simplest ways to see the distinction between e-mail service suppliers. To simplify issues, we ready a comparability of probably the most important API references for each Elastic Email and MailerSend:
Signing up
To create an Elastic Email account, click on right here. Select the Email API product and join free. You do not want to present any bank card info. After the registration, you're going to get a affirmation e-mail to confirm your account.
Organising a sending area
One of many first steps after creating your Elastic Email account might be to add and confirm your sending area. For instance, you will want to arrange the DNS settings of your area. Try our assist article to find out how to confirm your area step-by-step, or watch our information video beneath:
Creating your API Key
The subsequent essential step is to generate an API key. You have to it to present authentication to ship emails by way of our API. To generate your API key, enter settings in your Elastic Email account and go to Settings -> Handle API Keys -> Create.
At this level, you'll be able to set customized permissions and non-compulsory entry on your API key.
When you create your API key, maintain it secure as it is going to be used for each API name you make so as to establish you and make sure your account’s credentials. You possibly can create up to 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 worth.
Putting in API library
We extremely advocate you obtain and set up a repository of the programming language you utilize to begin sending emails by way of our API. Each MailerSend and Elastic Email have a wealthy number of e-mail API libraries and SDKs of many programming languages. It can make the migration course of very straightforward and handy for you. Simply as with MailerSend's e-mail API integration you put in a library or SDK, you want to do the identical with Elastic Email. Keep in mind that all our downloadable repositories can be found on Github.
Let’s present you the set up course of utilizing JavaScript. For instance, once you need 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 e-mail
Allow us to first check out what sending an e-mail by way of MailerSend API seems like:
import 'dotenv/config';
import { MailerSend, EmailParams, Sender, Recipient } from "mailersend";
const mailerSend = new MailerSend({
apiKey: course of.env.API_KEY,
});
const sentFrom = new Sender("[email protected]", "Your name");
const recipients = [
new Recipient("[email protected]", "Your Client")
];
const emailParams = new EmailParams()
.setFrom(sentFrom)
.setTo(recipients)
.setReplyTo(sentFrom)
.setSubject("This is a Subject")
.setHtml("This is the HTML content")
.setText("This is the text content");
await mailerSend.e-mail.ship(emailParams);
If you need to ship your first e-mail by way of Elastic Email, you want to load the library, get consumer occasion, use your newly generated Elastic Email API key, and create an occasion of EmailsApi that might be used to ship the e-mail. The 'API_KEY'
for the API key in MailerSend is now changed by "YOUR_API_KEY"
.
Based mostly on the JavaScript instance, right here’s the entire code for sending an e-mail to copy 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 referred to as efficiently.');
console.log('Email despatched.');
}
};
emailsApi.emailsPost(emailData, callback);
Email API Migration information: wrapping up
Now you already know all of the important steps on how to migrate from MailerSend to Elastic Email. You probably have any questions on how to combine with our e-mail API, don't hesitate to contact our buyer help workforce by way of dwell chat on our web site or in our app, or at [email protected]. They're out there for you 24/7 from day one.
Haven’t you signed up for an Elastic Email account? Attempt it out and begin sending emails with us as we speak!
Source link