Closed TidyIQ closed 5 years ago
I switched over to handlebars instead and now it works. No idea what the issue is with pug...
Duplicate issue. Please only open one.
Im getting this error working with ejs
@blakejoy Was you able to resolve your issue? If you did please share. I am using ejs but having same error. My directory structure
- utils
-- Emailer.js
- emails
-- default
---- html.ejs
---- subject.ejs
---- text.ejs
The email function was called from Emailer.js
// send email
email.send({
template: 'default',
locals: {
data: this.data,
config: this.config,
}
});
Emailer is exported on a expressjs route under directory /routes
Yes it had to do with the correcting the relative path of where the templates are pulled from. @prionkor
Hi! I was having the same issue running an app on Firebase (Firebase functions). If somebody has the same problem try with this:
const email = new Email({
views: {
root: path.join('', 'src/SOME_FOLDER/email/templates/'),
},
message: {
from: EMAIL_FROM,
},
transport: YOUR_TRANSPORTER,
})
email.send({
template,
message: {
to,
},
locals: {
...
},
})
Considering we have all the templates under that directory (templates) and each of them in its own folder.
Yes it had to do with the correcting the relative path of where the templates are pulled from. @prionkor
how @prionkor said.
Use this example command to debug and find the correct relative path:
NODE_DEBUG=email-templates node app.js
Hi, I'm not sure why this isn't working.
dist/emails/index.ts
dist/emails/emailConfirmation/html.pug
dist/emails/emailConfirmation/subject.pug
And when I call
sendEmailConfirmation(email, name, token)
, I get the following error in console: