Skip to content

Email Templates

Mia Winter edited this page Mar 15, 2024 · 5 revisions

⚠ This is subject to change ⚠ (will probably use razor templates with mjml for everything in the future)

E-Mail Templates

Wave allows you to customize the E-Mails it sends using MJML files.

If the E-Mail Newsletter Feature is enabled, Wave will populated the Configuration Directory with all the E-Mail templates it uses, otherwise it will create them as needed. You may also create them yourself. There are two types of Templates related to E-Mail sending: full email templates and partials templates.

Template files

All templates in Configuration will look as follows:

  • templates
    • email
      • default.mjml
      • newsletter.mjml
      • welcome.mjml
    • partials
      • email-article.html
      • email-author.html
      • email-plain-footer.html

Files in the email folder all full templates for mails and will be used for the various functions wave performs. Welcome and Newsletter are only used when you have enabled the Email Newsletter Feature. The welcome.mjml template is used when a user successfully signed up to your newsletter, the newsletter.mjml template is used whenever a new article gets distributed.

The default.mjml template is used for everything else, that includes email confirmation (on signup or when you change your account email), password resets, notifications on article status, etc.

The Partials are used to generate parts of an E-Mail within one of the other templates. email-article is used to generate the articles inside the welcome mail, the welcome mail takes the last three email-published articles and adds it to the end of the welcome mails' body, so new subscribers can have a look at what they might have missed. The email-author.html template is used at the end of a newsletter distributed mail, to insert a little user-card for that newsletters author, similar to the "About The Author" section on articles. The email-plain-footer.html is a special template that you only need to customize the unsubscribe-link for the plain text portion of the bulk emails.

Integrating with E-Mail distribution Services

E-Mail sending Services like Mailtrap and I believe Sendgrid too, usually want you to use their Unsubscribe links, as they keep track of exclusion lists to force you to comply with GDPR and the CAN-SPAM Act. You can replace the [[EmailUnsubscribeLink]] placeholder in the previous templates with their unsubscribe link or link placeholder to integrate those into your template, as they are otherwise usually appended to them in a possibly ugly way, and then you have two unsubscribe links which is confusing and probably illegal.

As you can Imagine, this will bypass Waves E-Mail subscriber system, as it will then only know of signups, not of unsubs or other events. Currently Wave has Webhook-APIs for the following Services to keep up to date with the state of individual subscribers.

Mailtrap Webhooks

TODO

TODO more webhook APIs