Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Use MJML for promote customer to staff confirmation e-mail

Anna Siwik831085af482a
diff --git a/saleor/dashboard/emails.py b/saleor/dashboard/emails.py
index 293a25cf47..52b47a008e 100644
--- a/saleor/dashboard/emails.py
+++ b/saleor/dashboard/emails.py
@@ -10,11 +10,12 @@ from templated_email import send_templated_mail
@shared_task
def send_set_password_email(staff):
site = Site.objects.get_current()
- ctx = {'protocol': 'http',
- 'domain': site.domain,
- 'site_name': site.name,
- 'uid': urlsafe_base64_encode(force_bytes(staff.pk)).decode(),
- 'token': default_token_generator.make_token(staff)}
+ ctx = {
+ 'protocol': 'http',
+ 'domain': site.domain,
+ 'site_name': site.name,
+ 'uid': urlsafe_base64_encode(force_bytes(staff.pk)).decode(),
+ 'token': default_token_generator.make_token(staff)}
send_templated_mail(
template_name='dashboard/staff/set_password',
from_email=settings.DEFAULT_FROM_EMAIL,
@@ -25,7 +26,10 @@ def send_set_password_email(staff):
@shared_task
def send_promote_customer_to_staff_email(staff):
site = Site.objects.get_current()
- ctx = {'domain': site.domain, 'site_name': site.name}
+ ctx = {
+ 'protocol': 'http',
+ 'domain': site.domain,
+ 'site_name': site.name}
send_templated_mail(
template_name='dashboard/staff/promote_customer',
from_email=settings.DEFAULT_FROM_EMAIL,
diff --git a/templates/templated_email/dashboard/staff/promote_customer.email b/templates/templated_email/dashboard/staff/promote_customer.email
index 77a553d67d..0ba692db02 100644
--- a/templates/templated_email/dashboard/staff/promote_customer.email
+++ b/templates/templated_email/dashboard/staff/promote_customer.email
@@ -13,5 +13,5 @@ This is an automatically generated email, please do not reply.
{% endblock %}
{% block html %}
-{% include 'templated_email/html/dashboard/staff/promote_customer.html' %}
+{% include 'templated_email/html/compiled/dashboard/staff/promote_customer.html' %}
{% endblock %}
diff --git a/templates/templated_email/html/compiled/dashboard/staff/promote_customer.html b/templates/templated_email/html/compiled/dashboard/staff/promote_customer.html
new file mode 100644
index 0000000000..8e49977ecf
--- /dev/null
+++ b/templates/templated_email/html/compiled/dashboard/staff/promote_customer.html
@@ -0,0 +1,150 @@
+<!doctype html>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
+<head>
+ <title></title>
+ <!--[if !mso]><!-- -->
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <!--<![endif]-->
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<style type="text/css">
+ #outlook a { padding: 0; }
+ .ReadMsgBody { width: 100%; }
+ .ExternalClass { width: 100%; }
+ .ExternalClass * { line-height:100%; }
+ body { margin: 0; padding: 0; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
+ table, td { border-collapse:collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; }
+ img { border: 0; height: auto; line-height: 100%; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; }
+ p { display: block; margin: 13px 0; }
+</style>
+<!--[if !mso]><!-->
+<style type="text/css">
+ @media only screen and (max-width:480px) {
+ @-ms-viewport { width:320px; }
+ @viewport { width:320px; }
+ }
+</style>
+<!--<![endif]-->
+<!--[if mso]>
+<xml>
+ <o:OfficeDocumentSettings>
+ <o:AllowPNG/>
+ <o:PixelsPerInch>96</o:PixelsPerInch>
+ </o:OfficeDocumentSettings>
+</xml>
+<![endif]-->
+<!--[if lte mso 11]>
+<style type="text/css">
+ .outlook-group-fix {
+ width:100% !important;
+ }
+</style>
+<![endif]-->
+
+<!--[if !mso]><!-->
+ <link href="https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700" rel="stylesheet" type="text/css">
+ <style type="text/css">
+
+ @import url(https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700);
+
+ </style>
+ <!--<![endif]--><style type="text/css">
+
+ address {
+ font-style: inherit;
+ font-family: Ubuntu, Helvetica, Arial;
+ }
+</style><style type="text/css">
+ @media only screen and (min-width:480px) {
+ .mj-column-per-100 { width:100%!important; }
+ }
+</style>
+</head>
+<body>
+
+ <div class="mj-container"><!--[if mso | IE]>
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="600" align="center" style="width:600px;">
+ <tr>
+ <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;" class="no-display-outlook">
+ <![endif]--><div style="display: none; margin: 0px auto; max-width: 600px;" class="no-display"><table role="presentation" cellpadding="0" cellspacing="0" style="font-size:0px;width:100%;" align="center" border="0"><tbody><tr><td style="text-align: center; vertical-align: top; direction: ltr; font-size: 0px; padding: 20px 0px;" align="center" valign="top"><!--[if mso | IE]>
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td style="vertical-align:top;width:600px;">
+ <![endif]--><div class="mj-column-per-100 outlook-group-fix" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;"><table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"><tbody><tr><td style="word-wrap: break-word; font-size: 0px; padding: 10px 25px;" align="left"><div style="cursor:auto;color:#000000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;text-align:left;">{% load i18n %}</div></td></tr></tbody></table></div><!--[if mso | IE]>
+ </td></tr></table>
+ <![endif]--></td></tr></tbody></table></div><!--[if mso | IE]>
+ </td></tr></table>
+ <![endif]-->
+ <!--[if mso | IE]>
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="600" align="center" style="width:600px;" class="no-display-outlook">
+ <tr>
+ <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
+ <![endif]--><div style="display: none; margin: 0px auto; max-width: 600px;" class="no-display"><table role="presentation" cellpadding="0" cellspacing="0" style="font-size:0px;width:100%;" align="center" border="0"><tbody><tr><td style="text-align: center; vertical-align: top; direction: ltr; font-size: 0px; padding: 20px 0px;" align="center" valign="top"><!--[if mso | IE]>
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td style="vertical-align:top;width:600px;">
+ <![endif]--><div class="mj-column-per-100 outlook-group-fix" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;"><table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"><tbody><tr><td style="word-wrap: break-word; font-size: 0px; padding: 10px 25px;" align="left"><div style="cursor:auto;color:#000000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;text-align:left;">{% load staticfiles %}</div></td></tr></tbody></table></div><!--[if mso | IE]>
+ </td></tr></table>
+ <![endif]--></td></tr></tbody></table></div><!--[if mso | IE]>
+ </td></tr></table>
+ <![endif]-->
+ <!--[if mso | IE]>
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="600" align="center" style="width:600px;">
+ <tr>
+ <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
+ <![endif]--><div style="margin:0px auto;max-width:600px;"><table role="presentation" cellpadding="0" cellspacing="0" style="font-size:0px;width:100%;" align="center" border="0"><tbody><tr><td style="text-align: center; vertical-align: top; direction: ltr; font-size: 0px; padding: 20px 0px;" align="center" valign="top"><!--[if mso | IE]>
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td style="vertical-align:top;width:600px;">
+ <![endif]--><div class="mj-column-per-100 outlook-group-fix" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;"><table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"><tbody><tr><td style="word-wrap: break-word; font-size: 0px; padding: 10px 25px;" align="center"><table role="presentation" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0px;" align="center" border="0"><tbody><tr><td style="padding: 5px; width: 176px;" width="176"><img alt="" height="38px" src="{{ protocol}}://{{ domain }}{% static 'images/logo-document.svg' %}" style="border:none;border-radius:0px;display:block;font-size:13px;outline:none;text-decoration:none;width:100%;height:38px;" width="176"></td></tr></tbody></table></td></tr></tbody></table></div><!--[if mso | IE]>
+ </td></tr></table>
+ <![endif]--></td></tr></tbody></table></div><!--[if mso | IE]>
+ </td></tr></table>
+ <![endif]-->
+ <!--[if mso | IE]>
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="600" align="center" style="width:600px;">
+ <tr>
+ <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
+ <![endif]--><div style="margin:0px auto;max-width:600px;"><table role="presentation" cellpadding="0" cellspacing="0" style="font-size:0px;width:100%;" align="center" border="0"><tbody><tr><td style="text-align: center; vertical-align: top; direction: ltr; font-size: 0px; padding: 20px 0px;" align="center" valign="top"><!--[if mso | IE]>
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td style="vertical-align:top;width:600px;">
+ <![endif]--><div class="mj-column-per-100 outlook-group-fix" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;"><table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"><tbody><tr><td style="word-wrap: break-word; font-size: 0px; padding: 10px 25px;" align="left"><div style="cursor:auto;color:#000000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:16px;line-height:22px;text-align:left;">{% trans "Hi!" context "Promote customer to staff member confirmation e-mail text" %}</div></td></tr><tr><td style="word-wrap: break-word; font-size: 0px; padding: 10px 25px;" align="left"><div style="cursor:auto;color:#000000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;text-align:left;">{% blocktrans context "Promote customer to staff member confirmation e-mail text" %}
+ You're receiving this e-mail because you have been promoted to staff member at {{ domain }}.
+ {% endblocktrans %}</div></td></tr></tbody></table></div><!--[if mso | IE]>
+ </td></tr></table>
+ <![endif]--></td></tr></tbody></table></div><!--[if mso | IE]>
+ </td></tr></table>
+ <![endif]-->
+ <!--[if mso | IE]>
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="600" align="center" style="width:600px;">
+ <tr>
+ <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
+ <![endif]--><div style="margin:0px auto;max-width:600px;"><table role="presentation" cellpadding="0" cellspacing="0" style="font-size:0px;width:100%;" align="center" border="0"><tbody><tr><td style="text-align: center; vertical-align: top; direction: ltr; font-size: 0px; padding: 20px 0px;" align="center" valign="top"><!--[if mso | IE]>
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td style="vertical-align:top;width:600px;">
+ <![endif]--><div class="mj-column-per-100 outlook-group-fix" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;"><table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"><tbody><tr><td style="word-wrap: break-word; font-size: 0px; padding: 10px 25px;" align="left"><div style="cursor:auto;color:#000000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;text-align:left;">{% blocktrans context "Base e-mail text" %}
+ This is an automatically generated e-mail, please do not reply.
+ {% endblocktrans %}</div></td></tr></tbody></table></div><!--[if mso | IE]>
+ </td></tr></table>
+ <![endif]--></td></tr></tbody></table></div><!--[if mso | IE]>
+ </td></tr></table>
+ <![endif]-->
+ <!--[if mso | IE]>
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="600" align="center" style="width:600px;">
+ <tr>
+ <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
+ <![endif]--><div style="margin:0px auto;max-width:600px;background:#F2F2F2;"><table role="presentation" cellpadding="0" cellspacing="0" style="font-size:0px;width:100%;background:#F2F2F2;" align="center" border="0"><tbody><tr><td style="text-align: center; vertical-align: top; direction: ltr; font-size: 0px; padding: 20px 0px;" align="center" valign="top"><!--[if mso | IE]>
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td style="vertical-align:top;width:600px;">
+ <![endif]--><div class="mj-column-per-100 outlook-group-fix" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;"><table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"><tbody><tr><td style="word-wrap: break-word; font-size: 0px; padding: 10px 25px;" align="center"><div style="cursor:auto;color:#000000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;text-align:center;">{% blocktrans trimmed context "Base e-mail footer" %}
+ Sincerely, {{ site_name }}
+ {% endblocktrans %}</div></td></tr></tbody></table></div><!--[if mso | IE]>
+ </td></tr></table>
+ <![endif]--></td></tr></tbody></table></div><!--[if mso | IE]>
+ </td></tr></table>
+ <![endif]--></div>
+</body>
+</html>
\ No newline at end of file
diff --git a/templates/templated_email/html/dashboard/staff/promote_customer.html b/templates/templated_email/html/dashboard/staff/promote_customer.html
deleted file mode 100644
index a2f4620fbc..0000000000
--- a/templates/templated_email/html/dashboard/staff/promote_customer.html
+++ /dev/null
@@ -1,12 +0,0 @@
-{% extends "templated_email/html/base.html" %}
-{% load i18n %}
-
-{% block content %}
-{% blocktrans context "Promote customer to staff member confirmation e-mail text" %}
-<p>Hi!</p>
-
-<p>You're receiving this e-mail because you have been promoted to staff member at {{ domain }}.</p>
-
-<p>This is an automatically generated email, please do not reply.</p>
-{% endblocktrans %}
-{% endblock content %}
diff --git a/templates/templated_email/html/source/dashboard/staff/promote_customer.mjml b/templates/templated_email/html/source/dashboard/staff/promote_customer.mjml
new file mode 100644
index 0000000000..b8e1105822
--- /dev/null
+++ b/templates/templated_email/html/source/dashboard/staff/promote_customer.mjml
@@ -0,0 +1,30 @@
+<mjml>
+ <mj-head>
+ <mj-include path="../../shared/styles" />
+ </mj-head>
+ <mj-body>
+ <mj-container>
+ <mj-section css-class="no-display">
+ <mj-column>
+ <mj-text>
+ {% load i18n %}
+ </mj-text>
+ </mj-column>
+ </mj-section>
+ <mj-include path="../../shared/header" />
+ <mj-section>
+ <mj-column>
+ <mj-text font-size="16px">
+ {% trans "Hi!" context "Promote customer to staff member confirmation e-mail text" %}
+ </mj-text>
+ <mj-text>
+ {% blocktrans context "Promote customer to staff member confirmation e-mail text" %}
+ You're receiving this e-mail because you have been promoted to staff member at {{ domain }}.
+ {% endblocktrans %}
+ </mj-text>
+ </mj-column>
+ </mj-section>
+ <mj-include path="../../shared/footer" />
+ </mj-container>
+ </mj-body>
+</mjml>