For Developers By Developers

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.

Trusted by 120+ partners and delivering over 650 Million emails/month

Configure Referrals emails with SMTP for Hasura

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.

Prerequisites

You need to complete these given prerequisites, you can skip the step if you have already completed.

  1. Sign up for a Mailazy account.

  2. Complete Domain Authentication.

  3. Generate the Mailazy Access Key

Integrate Mailazy with Hasura

Write the webhook

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")); });

Set the environment variables

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

Send transactional emails with Mailazy

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.

Ready to get started?

Get started — it's free