From a14f89c8663c9cafecb1cc26918055e023ecbe42 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 12 Oct 2015 13:18:32 +0200 Subject: [PATCH] [FIX] website_mail,mass_mailing: better support for outlook This fix is about several issue of office oulook: - a fixed table width must be in pixel, using 100% of parent div width doesn't work, - a background-color on a div is not used, the background color should be on the table inside this div using the attribute "bgcolor", - the only way to center a table is to have a `
` tag arround it, or have an element arround it with "text-align: center", - having a background image doesn't seem to be possible. The two first are straightforward, but for the third: - in non-outlook: all the snippet are centered (since they all have "margin: auto" which is valid outside outlook), - in outlook: only a small part of the snippet with text-align:center or `
` arround them are centered. To escape a bigger code change, this commit unify the outlook behaviour by having all of the snippet left aligned in outlook (they are still middle centered in other application). For the background image, we need a fallback bgcolor and thus we need to have the background on the table element. There was also an issue between relative and absolute url for gmail. closes #9019 opw-650217 --- addons/mass_mailing/models/mail_mail.py | 5 +- addons/website_mail/views/snippets.xml | 58 ++++++------ .../views/theme/airmail_snippets.xml | 86 +++++++++-------- .../views/theme/cleave_snippets.xml | 90 +++++++++--------- .../website_mail/views/theme/go_snippets.xml | 84 +++++++++-------- .../views/theme/narrative_snippets.xml | 84 +++++++++-------- .../views/theme/neopolitan_snippets.xml | 84 +++++++++-------- .../views/theme/skyline_snippets.xml | 92 +++++++++---------- .../views/theme/sunday_snippets.xml | 86 +++++++++-------- .../views/theme/zenflat_snippets.xml | 84 +++++++++-------- 10 files changed, 368 insertions(+), 385 deletions(-) diff --git a/addons/mass_mailing/models/mail_mail.py b/addons/mass_mailing/models/mail_mail.py index 99aca1321a7..679a3d19a88 100644 --- a/addons/mass_mailing/models/mail_mail.py +++ b/addons/mass_mailing/models/mail_mail.py @@ -81,8 +81,9 @@ class MailMail(osv.Model): body = tools.append_content_to_html(base, body, plaintext=False, container_tag='div') # resolve relative image url to absolute for outlook.com def _sub_relative2absolute(match): - return match.group(1) + urlparse.urljoin(domain, match.group(2)) + '"' - body = re.sub('(]*\ssrc=")(/[^/][^"]+)"', _sub_relative2absolute, body) + return match.group(1) + urlparse.urljoin(domain, match.group(2)) + body = re.sub('(]*\ssrc=")(/[^/][^"]+)', _sub_relative2absolute, body) + body = re.sub(r'(<[^>]+\bstyle="[^"]+\burl\(\'?)(/[^/\'][^\'")]+)', _sub_relative2absolute, body) # generate tracking URL if mail.statistics_ids: diff --git a/addons/website_mail/views/snippets.xml b/addons/website_mail/views/snippets.xml index 1c75f87243d..00a0806b7e1 100644 --- a/addons/website_mail/views/snippets.xml +++ b/addons/website_mail/views/snippets.xml @@ -51,7 +51,7 @@