Skip to content

Conversation

@Manik-Khajuria-5
Copy link

@Manik-Khajuria-5 Manik-Khajuria-5 commented Nov 19, 2025

Summary

Fixes #1956

This PR fixes the behavior of the /@email-send endpoint when handling multipart or preformatted email messages.

Problem

Plone always prepended message_intro text to outgoing emails, even for multipart messages.
This broke the structure of multipart emails (HTML + text, attachments, etc.).

What this PR changes

  • Converts the message to a string when needed.
  • Parses the message using message_from_string.
  • Does NOT prepend intro text when the message is multipart.
  • Prepends intro text only for plain text messages.
  • Ensures payload is handled consistently.
  • Maintains backward-compatible behavior.

Why this is needed

Multipart messages must not have additional text injected into their payload, or the message structure becomes invalid.

News item

A news file was added: 1952.bugfix

@mister-roboto
Copy link

@Manik-Khajuria-5 you need to sign the Plone Contributor Agreement to merge this pull request.

Learn about the Plone Contributor Agreement: https://plone.org/foundation/contributors-agreement

If you have already signed the agreement, please allow a week for your agreement to be processed.
Once it is processed, you will receive an email invitation to join the plone GitHub organization as a Contributor.

If after a week you have not received an invitation, then please contact agreements@plone.org.

@mister-roboto
Copy link

@Manik-Khajuria-5 thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@Manik-Khajuria-5
Copy link
Author

@jenkins-plone-org please run jobs

@mister-roboto
Copy link

@Manik-Khajuria-5 you need to sign the Plone Contributor Agreement to merge this pull request.

Learn about the Plone Contributor Agreement: https://plone.org/foundation/contributors-agreement

If you have already signed the agreement, please allow a week for your agreement to be processed.
Once it is processed, you will receive an email invitation to join the plone GitHub organization as a Contributor.

If after a week you have not received an invitation, then please contact agreements@plone.org.

Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message intro is enforced to make sure the site is providing adequate context for the email. If we make this configurable it should be a setting that a site admin can configure in the mail control panel, not a parameter that can be overridden for a specific email.

@stevepiercy
Copy link
Contributor

@Manik-Khajuria-5 please edit your PR description as described in https://6.docs.plone.org/contributing/first-time.html#create-a-pull-request-from-your-fork item 2.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this news item, as it's already covered by the other news item, and this one does not conform with https://6.docs.plone.org/contributing/index.html#create-a-news-item-file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing! I’ve applied your suggested one-line news entry with my credit. The duplicate news file was also removed. Please let me know if anything else is needed.

Manik-Khajuria-5 and others added 2 commits November 30, 2025 14:19
Co-authored-by: Steve Piercy <web@stevepiercy.com>
@stevepiercy
Copy link
Contributor

One more time:

@Manik-Khajuria-5 please edit your PR description as described in https://6.docs.plone.org/contributing/first-time.html#create-a-pull-request-from-your-fork item 2.

Copy link
Contributor

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

News LGTM. This still needs a technical review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow /@email-send endpoint sending multipart messages

4 participants