NodeJS SMTP Integration Guide
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;
Start Sending mail using the code provided below:
const nodemailer = require("nodemailer");
let transport = nodemailer.createTransport({
host: "smtp.mailazy.com",
port: 587,
auth: {
user: "access_key",
pass: "access_secret",
},
authMethod: "LOGIN",
secureConnection: true,
requiresAuth: true,
requireTLS: true
});
const message = {
from: "sender@example.com", // Sender address
to: "recipient@example.com", // recipient address
subject: "Hello!", // Subject line
text: "Hello world!", // Plain text body
html: "<b>Hello world!</b>" // HTML body
};
transport.sendMail(message, function (err, info) {
console.log("here");
if (err) {
console.log(err);
} else {
console.log(info);
}
});