Last active
June 21, 2018 10:05
-
-
Save mrchrisadams/b73804732fa6d043f8930507158761a2 to your computer and use it in GitHub Desktop.
A rough sketch for how mjml and django-mail-builder would work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msg = build_message('email/welcome.email', {'user': request.user}) | |
msg.send() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load mjml %} | |
{% block subject %}Thanks for signing up to Awesome Site!{% endblock %} | |
{% block to %}{{ user.email }}{% endblock %} | |
{% block body %} | |
Thanks for joining our site! | |
We hope you love how awesome it is! | |
{% endblock %} | |
{% comment %} | |
As far as I can tell, this this would work by expanding our all the django variables declared, | |
*then* the contents in the mjml block would be rendered to create the compiled html. | |
Or does this happen before? | |
https://github.com/liminspace/django-mjml/blob/master/mjml/templatetags/mjml.py#L18 | |
{% endcomment %} | |
{% block html %} | |
{% mjml %} | |
<mjml> | |
<mj-body> | |
<mj-container> | |
<mj-section> | |
<mj-column> | |
<mj-text>Thanks for joining our site! </mj-text> | |
<mj-text>We hope you love how awesome it is!</mj-text> | |
</mj-column> | |
</mj-section> | |
</mj-container> | |
</mj-body> | |
</mjml> | |
{% endmjml %} | |
{% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment