Using email-templates (for nodemailer) with Loopback Mail

909 views
Skip to first unread message

Abou Kone

unread,
Feb 23, 2015, 9:44:55 AM2/23/15
to loopb...@googlegroups.com
I know Loopback uses nodemailer for handling email and email-templates is a good template engine to use with nodemailer. I would like to use it to pretty up my welcome and verification emails but digging into the code, it seems that at the end of the day the template is compiled using Loopback.template() when it comes down to it. Is there a way to integrate email-templates with Loopback.template?

Bryan Clark

unread,
Feb 23, 2015, 9:21:48 PM2/23/15
to loopb...@googlegroups.com

I know the templates directory has both a reset-form which is mostly empty (and note used?) and a verify template which does get used.
https://github.com/strongloop/loopback/tree/06c5267d92eaa2df14f06b374b135c8c0f0b4f89/templates

If you pass alternate options to the user.verify() method you'll be able to specify an alternate path if you'd rather your templates no be in the 'templates' directory or have different file names. 
https://github.com/strongloop/loopback/blob/a82b33ec5c3cd043c53fed222ece2db67fc77c3c/common/models/user.js#L320

I'm not aware of other methods, like a welcome mail but I agree that the email template system could use some organization.

~ B

Abou Kone

unread,
Feb 24, 2015, 4:21:16 PM2/24/15
to loopb...@googlegroups.com
Yeah the ability to specify your pre-compiled templates would really be useful here. I am still looking for a way to hack it. I know LB needs the template to compile it with the locals object but there might me some feature in email-templates or Loopback.template to inline the CSS needed by the template.
Reply all
Reply to author
Forward
0 new messages