Closed captaincaius closed 3 years ago
Need more information: what are mailgun's own templates?
Sure no problem.
You can save templates in mailgun's UI and then just pass the template name on "template" as a string along with the template variables in json as h:X-Mailgun-Variables. See here: https://documentation.mailgun.com/en/latest/user_manual.html#templates
The cool thing about doing it this way is that someone can iterate on your email templates without needing to touch any code.
I did a little hack to allow using it this way... https://github.com/captaincaius/nodemailer-mailgun-transport/commit/60379c900698192f7fd7c58ea7347ba2229b7c42 ...and it works, BUT it probably breaks your existing templating because there's a collision in the key name (template).
As I said I'd be happy to help, but I'd need to know which of the 3 options you decide on.
The honest answer is I don't know. I feel like the 1) option is the right option but I am not sure how many people are currently using the current template feature. I wish there was a way to tag @here all people that use this package in NPM and ask their thoughts :) ahaha 🤔 🤔 🤔
@captaincaius 3 👍
@here
PR'ed in #82 - I went with option C as discussed, and documented it :D
@orliesaurus I see you closed #82 ... was this addressed some other way? Or is nodemailer-mailgun-transport not going to support mailgun templates?
@captaincaius If you can fix the conflicts, I am happy to take a look since there's been a rewrite :)
@orliesaurus nice rewrite!
I ported the tests over and to my surprise I noticed it supports both options on the template
key already (i.e. option 1) :+1:
So for the new PR I'll just add the one test, a little note in the README, and maybe a little comment.
This transport supports templating in-house, but not pointing to one of mailgun's own templates.
A quick one-line hack to whitelist 'template' seems to work on our end, but I believe that would break the existing template functionality, so it would need either:
I'd be happy to PR but need some decisions made first.
I'm guessing you'll say option 3, so if so, what do you want the new name to be?
Thanks