-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTML Body File Template with Variables #124
Comments
To add a bit more.
And then use a simple stringReplace to handle inline variables. However, one nice thing about the others is you can use bool/conditionals in your email templates as they render. Ie..
I would appreciate it if anyone has ideas on doing this. |
For relatively simple use cases, perhaps you can keep your text/html in a struct. For example, something like this:
When it comes to mailing then you should simply use If you really want to be able to read the contents from a file, you could perhaps use Codable and load from a JSON or have a custom Decoder. Or you could use a templating system like Stencil or Tuxedo. |
I will look more into this. Loops are another good use for this.. like building a list of things in an email, all things I have come across recently. For simple things, like a username and one-time string, are fine, but more complex is obviously more difficult. I just thought I would highlight to desire to have something similar in this framework. |
Kitura already has a template engine in place for the web server component -- is it reasonable to try using Stencil, or does that wind up pulling in other unnecessary stuff? |
Other SMTP / email libraries for JS or Python have the ability to "render" an html files and pass through variables.
ie.. pseudo code:
I know I can pass html as a string and use variable that way, but that would make a for a lot in one file. Any other suggestions or could something like this be possible as feature request?
The text was updated successfully, but these errors were encountered: