Closed poliveira89 closed 8 years ago
Hey, it looks like you are using handlebars. Unfortunately, there is an issue with this. I haven't had a chance to put together a PR yet, but it's coming.
In the mean time, try this out inside of Enquiry.js
(model)
new keystone.Email({
templateExt: 'hbs',
templateEngine: require('express-handlebars'),
templateName: 'enquiry-notification'
}).send({
to: admins,
from: {
name: 'yourproject@gmail.com,
email: 'contact@gmail.com'
},
subject: 'New Enquiry for Project Name',
enquiry: enquiry
}, callback);
I seem to be using require('handlebars')
in my project right now, but I did notice keystone's generator uses express-handlebars
. If you seem to have an error with express-handlebars
, just replace it with handlebars
I got the same problem, whatever the template engine. I think you don't copy the templates in the correct subfolder : https://github.com/keystonejs/generator-keystone/issues/110
I use the keystone generator to scaffold out a project. It could be as simple as that but I remember debugging this awhile ago and tracing it down to a view engine issue.
I hope this finds someone well. I was implementing notifications in a new project when I stumbled across this problem and after a short while realised we had solved this before with the following snippet.
Add to keystone.js:
// Switch Keystone Email defaults to handlebars
keystone.Email.defaults.templateExt = 'hbs';
keystone.Email.defaults.templateEngine = require('handlebars');
Thanks @hatzipanis this is a great place to put it!
I'll close this since the question was answered by @hatzipanis!
I have configured my
.env
file to which container Mandrill environment variables. And when I executenode keystone
I don't receive any error.But for some reason when I submit a new Enquiry I don't receive any notification email, it isn't even sent though Mandrill API as far I can see on their dashboard.
I tried to append some debug messages on the code. I added this code to
models/Enquiry.js
on line 34:This appeared on the Terminal:
I have looked into it and I do not have
/home/vagrant/keystone/templates/emails/enquiry-notification/email.jade
but instead I got/home/vagrant/keystone/templates/emails/enquiry-notification.hbs
with the following content:Anyone here already tried to use Mandrill? And can used successfully?
PS: Giving some context: