Git Product home page Git Product logo

Comments (3)

michaelbromley avatar michaelbromley commented on May 17, 2024

Implementation proposal

email-component-diagram

  1. Various events are generated by the Vendure Server and published via the EventBus (#40).
  2. EmailEventHandlers listen for a specific event and convert these events into EmailContext instances, which contain the information required to generate and send an email.
  3. The EmailGenerator takes an EmailContext object and uses the data to generate the body of the email based on a template. There will be standard, built-in templates but there must be a very simple way to provide custom templates since this will be needed by most shops.
  4. The output of the EmailGenerator is a GeneratedEmail instance, which is just the EmailContext with the addition of a body string.
  5. The GeneratedEmail is passed to the EmailTransport which actually sends the email to the recipient.

from vendure.

michaelbromley avatar michaelbromley commented on May 17, 2024

Templating

Templates should use a templating language to allow the actual data (customer name, order contents etc) to be interpolated when generating the HTML.

The specific quirks of designing emails (needs tables for layout, inline styles etc) suggest the use of a email framework. The main contenders are:

I like the look of MJML. However, it does not support templating features itself (interpolating variables, for loops) so we would need an additional templating layer which generates the MJML, which is then compiled into HTML. Handlebars is an obvious choice for the templating part.

from vendure.

michaelbromley avatar michaelbromley commented on May 17, 2024

Current status: The infrastructure is all there for transactional emails now. The only thing missing is the definition of all the email types (right now there is only "order confirmation" and "email verification".

The plan is to create config and templates for the other types as development of the rest of the UI / shopfront progresses. So I'll close this issue now since the foundation is complete.

from vendure.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.