Email API Integration Guide with NodeJs
Minimum code that you need to integrate Mailazy with your NodeJs application
Prerequisites
You need to complete these given prerequisites, you can skip the step if you have already completed.
- Sign up for a Mailazy account.
- Complete Domain Authentication.
- Generate the Mailazy Access Key
Integrate Mailazy with NodeJs
- Confirm that you are using supported node.js version (10 or higher)
- Install the package via
npm
oryarn
- To install the package to your current project , simple type the following in your terminal:
npm i --save mailazy-node
- Start Sending mail using the code provided below:
const MailazyClient = require("mailazy-node");
const client = new MailazyClient({ accessKey: "", accessSecret: "" });
const fn = async () => {
try {
const resp = await client.send({
to: "test@example.com", // required
from: "no-reply@example.com", // Use domain you verified, required
subject: "", // required
text: "",
html: "",
});
console.log("resp: " + resp);
} catch (e) {
console.log("errror: " + e);
}
};
fn();