Support MJML syntax for marketing email
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Support MJML syntax for email
|
||||
|
||||
Version 7.8.0 - 2025-12-15
|
||||
--------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@ from trytond.model import (
|
||||
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 @@ class Activity(
|
||||
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):
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
* Support MJML syntax for email
|
||||
|
||||
Version 7.8.0 - 2025-12-15
|
||||
--------------------------
|
||||
|
||||
@@ -21,7 +21,7 @@ from trytond.model import (
|
||||
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 @@ class Message(Workflow, ModelSQL, ModelView):
|
||||
.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'))
|
||||
|
||||
Reference in New Issue
Block a user