odoo/odoo#194988

Created by Bugfix, Séna Serge Nshimiyimana (sesn)
Merged at ef4c082363a295249c1f925d9e9636da974d5e42

Statuses:

label
odoo-dev:16.0-opw-4126522-eml_attachament_encoding-sesn
head
b77840d524bd071b4c850cd5542fdeb35157c045
merged
7 months ago by SM Learn, Julien Castiaux (juc)
odoo/odoo
16.0 #194988
17.0 #198862
saas-17.4 #199099
18.0 #199116
saas-18.1 #199126
saas-18.2 #199137
saas-18.3
saas-18.4
19.0
master #199141

[FIX] base: binary encode "message/rfc822" mail attachments

Currently, if an email containing a .eml attachment is sent, that attachment won't be able to be downloaded correctly depending on the email client used; the attachment will download, but will have a size zero.

Steps to reproduce

  • On any chatter, send a message containing a .eml attachment (another email file).
  • Using Thunderbird, attempt to download that attachment.

The downloaded attachment will be empty (0 kB).

Cause

The .eml file format, which represents an email message, has the MIME type message/rfc822. According to RFC 2046 Section 5.2.1, attachments of this MIME type must be encoded using 7bit, 8bit, or binary. However, the system currently encodes all attachments using Base64 by default, which is not compliant with the standard for message/rfc822.

Although some email clients tolerate Base64 encoding for message/rfc822, others, such as Thunderbird, Roundcube, and Zimbra, strictly follow the RFC and reject Base64-encoded message/rfc822 attachments. As a result, these attachments appear invalid and are downloaded as empty files.

opw-4126522