Problem description
Hello, I am trying to use html templates using nodemailer's external renderer functionality. I therefore import nodemailer and EmailTemplates for my template engine that will be pug. I create my transporter with the due credentials.
To create the template base sender function I have to use the transporter's templateSender function that apparently doesn't exist since I am getting an undefined function error.
Documentation Link for this process: https://community.nodemailer.com/2-0-0-beta/templating/
Has anyone encountered the problem? Maybe it is an issue and if it is I will therefore submit an issue but I prefer checking if my code isn't the actual problem..
Exisiting Code
import nodemailer from "nodemailer";
import EmailTemplate from "email-templates";
export default async function(userMail, typeOfMail, link) {
const transporter = nodemailer.createTransport({
port: process.env.SMTP_PORT,
host: process.env.SMTP_SERVER_NAME,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS
}
});
console.log(transporter.templateSender)
const sendAccountValidation = transporter.templateSender(
new EmailTemplate("../email_templates/account_validation"),
{
from: process.env.SMTP_USER
}
);
sendPwdReminder(
{
to: "dest@email.com",
subject: "subject"
},
function(err, info) {
if (err) {
console.log("Error");
} else {
console.log("Password reminder sent");
}
}
);
}
Error message
UnhandledPromiseRejectionWarning: TypeError: transporter.templateSender is not a function
Environment
- Docker
- nodemailer: "^6.2.1"
- email-templates: "^6.0.2"
Thanks for the help