forwardemail / email-templates

Create, preview (browser/iOS Simulator), and send custom email templates for Node.js. Made for @forwardemail, @ladjs, @cabinjs, @spamscanner, and @breejs.
https://forwardemail.net/docs/send-emails-with-node-js-javascript
MIT License
3.64k stars 339 forks source link

Alternate templating engine not working. #415

Closed iqbal125 closed 3 years ago

iqbal125 commented 3 years ago

So i tried to follow the getting started docs and I got the pug version to work correctly, but it doesnt seem to working for other templating engines.

Here is my code not sure what Im doing wrong. I also followed the directory structure /root/emails/name-of-template

html.ejs `

Hello

subject.ejs <%= STRING %> `

email.js `import Email from 'email-templates'; import nodemailer from 'nodemailer';

const transporter = nodemailer.createTransport({ host: 'smtp.mailtrap.io', port: 465, secure: false, auth: { user: pass: } });

export const email = new Email({ send: true, transport: transporter, preview: false });

export const sendEmail = () => { email .send({ template: 'password', message: { from: 'Steve Milburn no-reply@blog.com', to: 'john@snow.com' //subject: 'EEEEEE' }, locals: { fname: 'John', lname: 'Snow' }, views: { options: { extension: 'ejs' } } }) .then(() => console.log('email has been sent!')); }; `

niftylettuce commented 3 years ago

This is most likely a configuration issue or an issue with consolidate package? I think we have some examples/tests that do EJS if you want to look through them.