Fix an issue with feedback emails with text and html body, and an attachment.#2694
Merged
pstaabp merged 1 commit intoopenwebwork:WeBWorK-2.20from May 6, 2025
Merged
Conversation
f693450 to
cc8fbd0
Compare
Alex-Jordan
approved these changes
Apr 5, 2025
Member
|
I don't have a way to test this right now, but looks fine. |
fde7824 to
17ae6fe
Compare
3d62fc2 to
e792d88
Compare
…achment.
Email::Stuffer incorrectly adds an attachment together with the text and
html body parts all at the same level with content type multipart/mixed.
Structurally this is as follows:
[
(content type multipart/mixed)
text body,
html body,
attachment
]
As a result, when an email has a text body, an html body, and an
attachment, both the text and html are shown in most email clients.
The text and html body should be parts of a separate part that has
content type 'multipart/alternative'. So the email has two parts, and
the first part has two parts in that which are the text and html body.
The second part is the attachment. The following shows how it should be
structurally:
[
(content type multipart/mixed)
[
(content type multipart/alternative)
text body,
html body
],
attachment
]
To fix this, before adding an attachment the text and html body are
moved into a separate part with content type multipart/alternative.
e792d88 to
75c1889
Compare
pstaabp
approved these changes
May 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Email::Stuffer incorrectly adds an attachment together with the text and html body parts all at the same level with content type multipart/mixed. Structurally this is as follows:
As a result, when an email has a text body, an html body, and an attachment, both the text and html are shown in most email clients.
The text and html body should be parts of a separate part that has content type 'multipart/alternative'. So the email has two parts, and the first part has two parts in that which are the text and html body. The second part is the attachment. The following shows how it should be structurally:
To fix this, before adding an attachment the text and html body are moved into a separate part with content type multipart/alternative.
This is something that I noticed when working on issue #2690. I use Thunderbird, and was confused when I got the old text email with the attachment. Scrolling down I discovered that the html body was there as well.