Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

email templates #4685


User avatar
0
vladsd created

Did anyone implemented an elegant email template in this framework?

Are there 3rd party email templates solution in C#?

Thanks.


9 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    I would create HTML files like MyHelloTemplate.en.html , MyHelloTemplate.fr.html, MyHelloTemplate.tr.html check the user's language to pick up the right template. And a template content can be like below;

    Hello <CustomerName>,
    Wellcome to the system! Your registration ends on <EndDate>
    

    And replace all <*> strings with the values you get from entities. Then send via email. That's it!

  • User Avatar
    0
    vladsd created

    @alper - thank you. While it works for templates you predefined, it would not work if you want non programmer to change template content.

    I found a good directory of prebuild template system. Maybe Zero can adopt one? <a class="postlink" href="http://nugetmusthaves.com/Tag/Templating">http://nugetmusthaves.com/Tag/Templating</a>

  • User Avatar
    0
    BobIngham created

    Hi Vlad, Take a look at Postal: [http://aboutcode.net/postal/]). I have used this before with Hangfire. Save your template data from a wysiwyg component and load it into a cshtml file by passing a TemplateId to the Postal send email method. The Hangfire bit allows you to do this asynchronously.

  • User Avatar
    0
    alper created
    Support Team

    in my solution, you can present the HTML files to the user for editing. You can use a WYSIWYG editor.

  • User Avatar
    0
    vladsd created

    @alper - do you mean, that you suggest to store those user custom template on the server or in database? What about upgrades or multihost system?

    @bobIngham - thanks for the link,I will check out.

    I just think a framework like zero should have an easy to use/customize email, and static content system.

  • User Avatar
    0
    faisalalam created

    we should have simple email template with mail merge

  • User Avatar
    0
    vladsd created

    @faisalalam - does it mean its on the list for next release?

  • User Avatar
    0
    alper created
    Support Team

    hi, I mean you can store it in database with UserId or TenantId. So that you can filter templates by a specific user/tenant. Something like this AppEmailTemplates table has UserId, HtmlContent And you'll have some predefined placeholders like <DateNow>, <NameSurname>, <SubscriptionEndDate> etc...

  • User Avatar
    0
    vladsd created

    @alper - thanks. yes, we are on the same page. for sure it can be build. i am happy to wait for next release if its on your roadmap.

    besides entity and db mapping, one needs to make sure its used just in time when needed.

    in addition, it would be nice to allow flexible template config, so API can be used to send emails via backend by tenants.