Why can not I get any content in the email sent to the user?

I am trying to send an email to the user when he press the Forgot Password button and types his email. But the user is getting a blank email. The code is given below

const nodemailer  = require('nodemailer');
const path        = require('path');
const fs          = require('fs');
const handlebars  = require('handlebars');

// Constants
const Message     = require("../Constants/Message.js");

//Creating a transport here
//I am using my own gmail account to send user his required token to change password

function createTransport() {
    return nodemailer.createTransport({
        host:  'smtp.gmail.com',
        secureConnection:  true,
        port:  465,
        auth: {
            user:  '******@gmail.com',
            pass:  '*****',

// checking if the transport is created or not

//If the transport isn’t ready then make sure to give an error async function verifyTransport(transport) {

    let res;
    await transport.verify(function(error, success) {
        if (error) {
            res = error;
        } else {
            res = success;
            console.log('Server is ready to take our messages');

    return res;

//Sending email in the form of html //My html file is correct function generateHtmlToSend(fileName) { const filePath = path.join(__dirname, ‘../Mails/’+fileName); const source = fs.readFileSync(filePath, ‘utf-8’).toString(); const template = handlebars.compile(source); return template; }

function setMailOptions(email,subject,fileName)
    return mailOptions = {
        from:  'shehroz.virk147@gmail.com',
        to: email,
        subject: subject,

async function sendEmail(subject,fileName,email)
    const transport = createTransport();
    const transportVerify = await verifyTransport(transport);
    const mailOptions = setMailOptions(email,subject,fileName);

    await transport.sendMail(mailOptions, function (error, info) {
        if (error) {
        } else {
            console.log('Email sent: ' + info.response);

function sendForgotPasswordEmail(email){

module.exports = {sendForgotPasswordEmail}

Where am I doing it wrong? What is the main issue??


The issue is in your generateHtmlToSend, Use return template("UseLinkHere");