summaryrefslogtreecommitdiff
path: root/odoo
diff options
context:
space:
mode:
authorstd-odoo <std@odoo.com>2021-01-15 09:41:40 +0000
committerJulien Castiaux <juc@odoo.com>2021-01-18 15:06:14 +0000
commit8663f1e20727c315924bb20fc1de1accf3014c61 (patch)
treedfeb7676c51f07ac6f5b36025d545fe80d8755da /odoo
parent03788855d0ca6cc432d7bf5f8c2192af846be09e (diff)
[FIX] base: specify the charset the the SMTP headers
The emails sent via Odoo reveive a poor score on various spam tools, the reason being the missing `MIME-Version` message header. This header inform what MIME version is in use in the message. Even if there is only one standardized version of MIME (1.0), the header is mandatory. Citing [rfc2045] "MIME: Format of Internet Message Bodies" section 4: > the MIME-Version header field is required at the top level of a message. Setting the charset on the envelop forces the EmailMessage API to also include the missing `MIME-Version` header. [rfc2045]: https://tools.ietf.org/html/rfc2045#section-4 Task 2393865 closes odoo/odoo#64651 Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
Diffstat (limited to 'odoo')
-rw-r--r--odoo/addons/base/models/ir_mail_server.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/odoo/addons/base/models/ir_mail_server.py b/odoo/addons/base/models/ir_mail_server.py
index 111e4f19910..4e9f774fa2b 100644
--- a/odoo/addons/base/models/ir_mail_server.py
+++ b/odoo/addons/base/models/ir_mail_server.py
@@ -288,6 +288,8 @@ class IrMailServer(models.Model):
body = body or u''
msg = EmailMessage(policy=email.policy.SMTP)
+ msg.set_charset('utf-8')
+
if not message_id:
if object_id:
message_id = tools.generate_tracking_message_id(object_id)