summaryrefslogtreecommitdiff
path: root/addons/mass_mailing/models/mail_mail.py
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2016-01-05 18:28:06 +0100
committerMartin Trigaux <mat@odoo.com>2016-01-05 18:28:06 +0100
commit8b4f052a3872b397bbe252e353b1d18d273ec8ff (patch)
treed5f8dd6d6dbc5065affadbbfed44d02f28733195 /addons/mass_mailing/models/mail_mail.py
parentc649bb0df61eb19de510992cc5f2200fef89cb82 (diff)
parent0f085db19e496c31d12ca66bcf75c2ac239b8667 (diff)
[MERGE] Forwardport of branch saas-6 up to c649bb0df
Diffstat (limited to 'addons/mass_mailing/models/mail_mail.py')
-rw-r--r--addons/mass_mailing/models/mail_mail.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/mass_mailing/models/mail_mail.py b/addons/mass_mailing/models/mail_mail.py
index cc9928ca8ac..1256280c00b 100644
--- a/addons/mass_mailing/models/mail_mail.py
+++ b/addons/mass_mailing/models/mail_mail.py
@@ -5,6 +5,7 @@ import re
import urlparse
import re
import werkzeug.urls
+import re
from openerp import tools
from openerp import SUPERUSER_ID
@@ -86,6 +87,14 @@ class MailMail(osv.Model):
body = re.sub('(<img(?=\s)[^>]*\ssrc=")(/[^/][^"]+)', _sub_relative2absolute, body)
body = re.sub(r'(<[^>]+\bstyle="[^"]+\burl\(\'?)(/[^/\'][^\'")]+)', _sub_relative2absolute, body)
+ # resolve relative image url to absolute for outlook.com
+ def _sub_relative2absolute(match):
+ return match.group(1) + urlparse.urljoin(domain, match.group(2))
+ # Regex: https://regex101.com/r/aE8uG5/3
+ body = re.sub('(<img(?=\s)[^>]*\ssrc=["\'])(/[^/][^"\']+)', _sub_relative2absolute, body)
+ # Regex: https://regex101.com/r/kT3lD5/2
+ body = re.sub(r'(<[^>]+\bstyle=["\'][^"\']+\burl\([\'"]?)(/[^/\'"][^\'")]+)', _sub_relative2absolute, body)
+
# generate tracking URL
if mail.statistics_ids:
tracking_url = self._get_tracking_url(cr, uid, mail, partner, context=context)