Skip to content

Conversation

@Manik-Khajuria-5
Copy link

@Manik-Khajuria-5 Manik-Khajuria-5 commented Feb 2, 2026

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, including multipart messages.

For multipart emails (HTML + text, attachments, etc.), this breaks the message structure and results in invalid emails.


What this PR changes

  • Converts the message to a string when required
  • Parses the message using message_from_string
  • Avoids prepending intro text for multipart messages
  • Prepends intro text only for plain text messages
  • Handles the message payload more consistently
  • Keeps backward-compatible behavior

Why this is needed

Multipart email messages must preserve their original structure.
Injecting additional text into multipart payloads corrupts the MIME format and can break email rendering or attachments.


News item

Added a bugfix news entry:

1956.bugfix
  • I signed and returned the Plone Contributor Agreement, and received and accepted an invitation to join a team in the Plone GitHub organization.
  • I verified there aren't any other open pull requests for the same change.
  • I followed the guidelines in Contributing to Plone.
  • I successfully ran code quality checks on my changes locally.
  • I successfully ran tests on my changes locally.
  • If needed, I added new tests for my changes.
  • If needed, I added documentation for my changes.
  • I included a change log entry in my commits.

Closes #1956


📚 Documentation preview 📚: https://plonerestapi--1977.org.readthedocs.build/

@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

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

2 participants