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.67k stars 337 forks source link

Possible to send pre-rendered template #277

Closed sean-hill closed 6 years ago

sean-hill commented 6 years ago

Hey! I have two separate services, one that renders the email template, and one that sends it. Is it possible to send a HTML string to the send() function instead of having to specify a path to a template?

niftylettuce commented 6 years ago

@sean-hill currently it isn't, but maybe you'd be interested in submitting a pull request to add this?

you could do it in many was, but one might be to set template: false and then just pass in a message object with html and/or text properties

niftylettuce commented 6 years ago

@sean-hill a temporary workaround would be to just make and use a blank/empty template and then just pass message object to send() and include html and text and any others you want to manually specify like subject. these won't get overwritten if they're already set, see https://github.com/niftylettuce/email-templates/blob/master/src/index.js#L208.

sean-hill commented 6 years ago

Perfect thank you!