Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WD-15023 - chore: set up MJML #420

Merged
merged 2 commits into from
Sep 23, 2024
Merged

Conversation

huwshimi
Copy link
Contributor

Changes

Set up MJML email template builder (note: no templates have been added yet).

https://warthogs.atlassian.net/browse/WD-15023

@huwshimi huwshimi requested a review from a team as a code owner September 20, 2024 05:56
internal/mail/Makefile Outdated Show resolved Hide resolved
Copy link
Contributor

@shipperizer shipperizer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was left with the impression we were using backend templates with .gotpl

what did I miss?how are we going to operate with the templates from a backend perspective, or is the frontend doing the hard work and hitting the email endpoint with all the info it needs (risky if we pass the authentication code or password)?

cc @BarcoMasile

@huwshimi
Copy link
Contributor Author

I was left with the impression we were using backend templates with .gotpl

what did I miss?how are we going to operate with the templates from a backend perspective, or is the frontend doing the hard work and hitting the email endpoint with all the info it needs (risky if we pass the authentication code or password)?

The backend loads the templates e.g. https://github.com/canonical/identity-platform-admin-ui/blob/main/internal/mail/html/user-invite.html. However, we need a way to generate those templates, which we'll do using MJML (HTML emails use an HTML style from circa 2000 e.g. inline styles etc. and MJML streamlines generating the code and making it compatible with the various mail clients etc.)

@shipperizer
Copy link
Contributor

I was left with the impression we were using backend templates with .gotpl
what did I miss?how are we going to operate with the templates from a backend perspective, or is the frontend doing the hard work and hitting the email endpoint with all the info it needs (risky if we pass the authentication code or password)?

The backend loads the templates e.g. https://github.com/canonical/identity-platform-admin-ui/blob/main/internal/mail/html/user-invite.html. However, we need a way to generate those templates, which we'll do using MJML (HTML emails use an HTML style from circa 2000 e.g. inline styles etc. and MJML streamlines generating the code and making it compatible with the various mail clients etc.)

i m confused, need to see the whole thing working

@BarcoMasile
Copy link
Contributor

I was left with the impression we were using backend templates with .gotpl
what did I miss?how are we going to operate with the templates from a backend perspective, or is the frontend doing the hard work and hitting the email endpoint with all the info it needs (risky if we pass the authentication code or password)?

The backend loads the templates e.g. https://github.com/canonical/identity-platform-admin-ui/blob/main/internal/mail/html/user-invite.html. However, we need a way to generate those templates, which we'll do using MJML (HTML emails use an HTML style from circa 2000 e.g. inline styles etc. and MJML streamlines generating the code and making it compatible with the various mail clients etc.)

@huwshimi @shipperizer
To clarify: yes we use backend templates from the go standard library.
If @huwshimi prefers to do it with MJML it's fine, but I'd ask you to please put this somewhere else in the UI folder (and handle that subfolder as you wish), and refactor the Makefile to make sure that only the minified html (generated via this tool) ends up in the templates folder. This way only the minified html produced by MJML ends up in the backend build. Also, make sure the 3 go template variables are present after MJML generates the html.
Is that ok for you?

@huwshimi
Copy link
Contributor Author

@BarcoMasile I've moved these files to the UI dir.

Copy link
Contributor

@BarcoMasile BarcoMasile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @huwshimi

@shipperizer shipperizer merged commit 46ac8af into canonical:main Sep 23, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants