Documents and Emails
By the nature of running a shop we need to send plenty of emails containing plenty of documents. For this we have a set of tools to template, render and send both emails and documents.
Rendering
Rendering documents is fairly trivial. All our documents and emails are defined as React components. If you want to render one of them you can use the following code:
Emails are usually defined using MJML. For those you should use the renderMJMLDocument() method. The output is also just a simple string containing HTML
Sending Emails
To send emails you should use the outgoing email service. You can get it using getEmail(context.config). It only has a single method to send mails. Here is a complete sample:
Defining Documents
As mentioned before any react component should work. However there are a few components you might want to integrate:
- DocumentFooter: Standard document footer with required legal information
- EmailFooter: Email footer with socials, copyright and reply information
- DocumentHeader: Standard document header with the logo for the current event
- EmailHeader: The same but for emails
- StandardEmailTemplate: Setups up the email with backgrounds, fonts, header and footer
- DocumentWrapper: Wraps a document in a standard layout, please use this since it includes all legally required information!