medusa-plugin-nodemailer
A notification service based on Nodemailer & Handlebars templating engine.
Installation
To install, run the following command in your terminal:
npm install @lumot-eu/medusa-plugin-nodemailer
Add the following values to your medusa-config.js
file:
const plugins = [
{
resolve: "@lumot-eu/medusa-plugin-nodemailer",
options: {
fromAddress: process.env.MAIL_FROM_ADDRESS,
transport: {
host: process.env.MAIL_SMTP_HOST,
port: process.env.MAIL_SMTP_PORT,
auth: {
user: process.env.MAIL_SMTP_USER,
pass: process.env.MAIL_SMTP_PASS,
},
tls: {
rejectUnauthorized: false,
},
},
templateDir: "email-templates",
templateMap: {
"order.placed": {
name: "order.placed",
subject: "Order confirmation",
},
},
},
},
];
E-mail templates
Templates for each event should be placed in a sub-directory matching the name specified in the templateMap: eg. {templateDir}/order.placed
. The sub-directory must contain two files: html.hbs
for the HTML version and txt.hbs
for the plain text version of the email.