You can integrate Mailazy in minutes with your platform. Build and monitor your email solution on a trusted foundation with technical and strategic support when you need it the most.
Referrals emails is an important component of any email communication strategy. In order to ensure delivery of Referrals emails to your customers, reply on a trusted cloud-based email provider like Mailazy as a partner in your growth journey.
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
const nodemailer = require("nodemailer");
const transporter = nodemailer.createTransport(
"smtp://" +
process.env.SMTP_LOGIN +
":" +
process.env.SMTP_PASSWORD +
"@" +
process.env.SMTP_HOST
);
const fs = require("fs");
const path = require("path");
const express = require("express");
const bodyParser = require("body-parser");
const app = express();
app.set("port", process.env.PORT || 3000);
app.use("/", express.static(path.join(__dirname, "public")));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(function (req, res, next) {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Cache-Control", "no-cache");
next();
});
app.post("/send-email", function (req, res) {
const name = req.body.event.data.new.name;
// setup e-mail data
const mailOptions = {
from: process.env.SENDER_ADDRESS, // sender address
to: process.env.RECEIVER_ADDRESS, // list of receivers
subject: "A new user has registered", // Subject line
text:
"Hi, This is to notify that a new user has registered under the name of " +
name, // plaintext body
html:
"" +
"Hi, This is to notify that a new user has registered under the name of " +
name +
"
", // html body
};
// send mail with defined transport object
transporter.sendMail(mailOptions, function (error, info) {
if (error) {
return console.log(error);
}
console.log("Message sent: " + info.response);
res.json({ success: true });
});
});
app.listen(app.get("port"), function () {
console.log("Server started on: " + app.get("port"));
});
After remixing to your own project on Glitch, modify the .env file to enter the
- SMTP_LOGIN : mailazy_apikey
- SMTP_PASSWORD : mailazy_secret
- SMTP_HOST : smtp.mailazy.com
- SENDER_ADDRESS : sender email address
- RECEIVER_ADDRESS : receiver email address
Mailazy email delivery platform is powered by AI and uses the global infrastructure so that you can scale effortlessly. Mailazy is the trusted transactional email provider for hundreds of businesses and we are growing every day. We are known for being the most reliable and trusted senders on the internet.