details:   https://code.tryton.org/tryton/commit/ab41e8714d35
branch:    default
user:      Cédric Krier <[email protected]>
date:      Thu Dec 11 15:20:11 2025 +0100
description:
        Support MJML syntax for marketing email
diffstat:

 modules/marketing_automation/CHANGELOG               |  1 +
 modules/marketing_automation/marketing_automation.py |  5 ++++-
 modules/marketing_email/CHANGELOG                    |  1 +
 modules/marketing_email/marketing.py                 |  5 ++++-
 4 files changed, 10 insertions(+), 2 deletions(-)

diffs (60 lines):

diff -r d5204e72c1ba -r ab41e8714d35 modules/marketing_automation/CHANGELOG
--- a/modules/marketing_automation/CHANGELOG    Thu Dec 11 17:57:01 2025 +0100
+++ b/modules/marketing_automation/CHANGELOG    Thu Dec 11 15:20:11 2025 +0100
@@ -1,3 +1,4 @@
+* Support MJML syntax for email
 
 Version 7.8.0 - 2025-12-15
 --------------------------
diff -r d5204e72c1ba -r ab41e8714d35 
modules/marketing_automation/marketing_automation.py
--- a/modules/marketing_automation/marketing_automation.py      Thu Dec 11 
17:57:01 2025 +0100
+++ b/modules/marketing_automation/marketing_automation.py      Thu Dec 11 
15:20:11 2025 +0100
@@ -25,7 +25,7 @@
     fields)
 from trytond.pool import Pool
 from trytond.pyson import Eval, If, PYSONDecoder, TimeDelta
-from trytond.report import Report, html_to_text
+from trytond.report import Report, html_to_text, mjml_to_html
 from trytond.sendmail import SMTPDataManager, send_message_transactional
 from trytond.tools import grouped_slice, pairwise_longest, reduce_ids
 from trytond.tools.chart import sparkline
@@ -716,6 +716,9 @@
                     activity=self.rec_name,
                     exception=exception)) from exception
 
+        if content.startswith('<mjml'):
+            content = mjml_to_html(content)
+
         msg = self._email(translated.email_from, to, title, content)
 
         if has_rcpt(msg):
diff -r d5204e72c1ba -r ab41e8714d35 modules/marketing_email/CHANGELOG
--- a/modules/marketing_email/CHANGELOG Thu Dec 11 17:57:01 2025 +0100
+++ b/modules/marketing_email/CHANGELOG Thu Dec 11 15:20:11 2025 +0100
@@ -1,3 +1,4 @@
+* Support MJML syntax for email
 
 Version 7.8.0 - 2025-12-15
 --------------------------
diff -r d5204e72c1ba -r ab41e8714d35 modules/marketing_email/marketing.py
--- a/modules/marketing_email/marketing.py      Thu Dec 11 17:57:01 2025 +0100
+++ b/modules/marketing_email/marketing.py      Thu Dec 11 15:20:11 2025 +0100
@@ -21,7 +21,7 @@
     DeactivableMixin, Index, ModelSQL, ModelView, Unique, Workflow, fields)
 from trytond.pool import Pool
 from trytond.pyson import Eval
-from trytond.report import Report, get_email, html_to_text
+from trytond.report import Report, get_email, html_to_text, mjml_to_html
 from trytond.sendmail import SMTPDataManager, send_message_transactional
 from trytond.tools import grouped_slice, reduce_ids
 from trytond.tools.email_ import (
@@ -489,6 +489,9 @@
                     .filter(convert_href(message))
                     .render())
 
+                if content.startswith('<mjml'):
+                    content = mjml_to_html(content)
+
                 name = email.party.rec_name if email.party else ''
                 from_cfg = (config.get('marketing', 'email_from')
                     or config.get('email', 'from'))

Reply via email to