Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FW][FIX] base: missing MIME-Version header #109184

Conversation

fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Jan 5, 2023

This is a second attempt at #64651

The reverted commit fixes the lack of a MIME-Version header on the
mail enveloppe by using set_charset. More specifically, set_charset
sets three headers:

  • MIME-Version
  • Content-Type
  • Transert-Encoding

of them only MIME-Version was required.

The function was called prior of setting the mail's content or
alternatives.

Upon adding an alternative, python converts the current mail to a
multipart equivalent. Because of the two extra CT and TE headers, it
considered there was some content that needed to be moved inside of a
part, i.e. it created an empty part with the two CT and TE headers
set.

This empty part made our emails incompatible with Google G-Suite in case
an rich html footer was included via the G-Suite interface. Google would
wrongly reorder the email and move any text/plain part to the end of the
email and would show that part to the user instead of any text/html
part.

Be conservative in what you send

Google shouldn't change the order of our alternatives but he does and
it is easier for me to change our code than to fix google's.

Forward-Port-Of: #109056
Forward-Port-Of: #108499

Send an rich HTML email from Odoo, it lands in spam whereas it would
land in inbox in 13.0.

The problem is due to a missing "MIME-Version: 1.0" header on the email.
This header is correctly set on both the html and text alternatives of
the messages but it should be set on the enveloppe too.

The problem is present in the newer EmailMessage mail API of python that
is used since 14.0. Using the newer API, it doesn't set the header on
the enveloppe itself.

This reverts commit 8663f1e.

opw-3098621

X-original-commit: c480d2b
@robodoo
Copy link
Contributor

robodoo commented Jan 5, 2023

@fw-bot
Copy link
Contributor Author

fw-bot commented Jan 5, 2023

This PR targets saas-15.3 and is part of the forward-port chain. Further PRs will be created up to master.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@C3POdoo C3POdoo added the RD research & development, internal work label Jan 5, 2023
@robodoo robodoo added the forwardport This PR was created by @fw-bot label Jan 5, 2023
robodoo pushed a commit that referenced this pull request Jan 5, 2023
Send an rich HTML email from Odoo, it lands in spam whereas it would
land in inbox in 13.0.

The problem is due to a missing "MIME-Version: 1.0" header on the email.
This header is correctly set on both the html and text alternatives of
the messages but it should be set on the enveloppe too.

The problem is present in the newer EmailMessage mail API of python that
is used since 14.0. Using the newer API, it doesn't set the header on
the enveloppe itself.

This reverts commit 8663f1e.

opw-3098621

closes #109184

X-original-commit: c480d2b
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Signed-off-by: Julien Castiaux <juc@odoo.com>
@robodoo robodoo temporarily deployed to merge January 5, 2023 19:34 Inactive
@robodoo robodoo closed this Jan 5, 2023
@fw-bot fw-bot deleted the saas-15.3-14.0-email_alternative_order-juc-kEiR-fw branch January 19, 2023 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forwardport This PR was created by @fw-bot RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants