I am using Mailgun API with nodejs+express to send emails. I want to transition into using templates instead of writing the whole email as the HTML tag in nodejs.
The Mailgun documentation shows how to send variables to the template but not how to use them inside the template.
This is how I'm sending the Mailgun request
const data = {
from: "Shared Video <Share@website-template.com>",
to: shareTo,
subject: subject,
template: "share_video",
v: (subject = subject),
v: (shareToName = shareToName),
v: (userName = userName),
v: (videoTitle = videoTitle),
v: (videoID = videoID),
};
mailgun.messages().send(data, function (error, body) {
console.log(body);
req.flash("success", "Video Shared");
res.redirect("/");
});
So how can I use those variables in the email template?