Skip to content

Commit

Permalink
Support HTML email templates (#885)
Browse files Browse the repository at this point in the history
* Add initial support for MJML templates

This commit adds a Gradle task to generate .ms templates from .mjml templates. The main goal is to be able to send responsive HTML emails.

* Fix exceptions thrown when adding to immutable Map

This commit fixes the exceptions caused by additions to the email data created with Map.of (which returns an immutable Map)

* Initial work for HTML templates

This commit adds the support for rendering multipart emails, rendering both plain text  and HTML versions of the email. It also has the first HTML template for the confirmation email for organizers.

* Remove overridable attribute from TemplateResource

This commit removes the overridable attribute from the TemplateResource constructor as it was set to true in all of them (except the deprecated ones). The overridable property is always set to true, but might be removed in the future.

* Add configuration key to enable HTML emails

This commit adds the configuration key to enable HTML emails at system, organization and event levels. The default value is true. When disabled, only plain text templates will be rendered, HTML templates will be omitted.

* Update HTML template design
Make the look and feel similar to the public site design

* Add HTML email for expiring reservations for organizers

* Add HTML render to email checksum
Prior to this commit, only the plain text message was included in the checksum. This commit also takes the HTML message into account, to avoid false positives in the checksum comparison

* Change template header color for confirmation email for organizers

* Add HTML template for attendee confirmation email

* Add missing language translations

* Add rel="notrack" to email links

Avoid email tracking and rewriting on email links. More here: https://app.mailjet.com/support/how-to-exclude-a-link-from-being-tracked-when-click-tracking-is-enabled,721.htm

* Change default email template font to Source Sans Pro
  • Loading branch information
salmar committed Apr 3, 2020
1 parent d9eef48 commit 7d4cac1
Show file tree
Hide file tree
Showing 62 changed files with 4,128 additions and 291 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ out/
alfio-itest
.gradletasknamecache
public/
lsp
node_modules/
lsp
12 changes: 12 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ plugins {
id 'org.springframework.boot' version '2.2.2.RELEASE'
id 'org.sonarqube' version '2.8'
id 'net.ltgt.errorprone' version '1.1.1'
id 'com.github.node-gradle.node' version '2.2.3'
}

apply plugin: 'java'
Expand Down Expand Up @@ -475,3 +476,14 @@ release {
// see https://github.com/freefair/gradle-plugins/issues/31#issuecomment-475355674
// since we have a custom lombok.config configuration file, we disable automatic override
generateLombokConfig.enabled = false

// MJML email templates translations to HTML
node {
download = true
}

task mjmlToHtml( type: NodeTask, dependsOn: 'npmInstall' ) {
script = file( 'src/main/node/mjmlToHtml.js' )
}

build.dependsOn mjmlToHtml
Loading

0 comments on commit 7d4cac1

Please sign in to comment.