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

Custom render function doesn't work as documented #288

Closed mjamado closed 6 years ago

mjamado commented 6 years ago

The documentation is missing - or at least misleading - on "Custom Rendering (e.g. from a MongoDB database)".

One would expect that, by providing the render function in the configuration object, the template would be rendered by that function, period. However, the flow of a send goes through renderAll, which checks if there's real files on disk.

This is not documented.

Note that I'm not suggesting the documentation should change; what I'm suggesting is that the behaviour changes completely: if a custom render function is provided, renderAll shouldn't check for files at all.

niftylettuce commented 6 years ago

@mjamado would love a PR + tests for this. great point.

mjamado commented 6 years ago

I'll try, but I can't promise (callback won't work either - I'm so sorry for this pun).

If anyone lands here, one workaround is to just create the file structure on disk anyway, with empty pug files. Highly ineffective, but gets the job done.

niftylettuce commented 6 years ago

Published as v3.6.0 to npm, thanks @mjamado.