Skip to content

Conversation

@AaronDDM
Copy link
Collaborator

@AaronDDM AaronDDM commented May 30, 2025

Description

Previously, the SDK only considered attachment size when determining whether to use multipart/form-data encoding, ignoring the email body size. This caused requests to fail when the combined size of message body and attachments exceeded 3MB, even if attachments alone were under the limit.

Changes:

  • Add calculateTotalPayloadSize() function to calculate total request payload size

  • Update Messages.send() to use total payload size instead of just attachment size

  • Update Drafts.create() and Drafts.update() to use total payload size

  • Add comprehensive tests to verify the fix works correctly

Fixes: Requests failing when total payload exceeds 3MB despite small attachments

License

I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner.

Previously, the SDK only considered attachment size when determining whether to use multipart/form-data encoding, ignoring the email body size. This caused requests to fail when the combined size of message body and attachments exceeded 3MB, even if attachments alone were under the limit.

Changes:

- Add calculateTotalPayloadSize() function to calculate total request payload size

- Update Messages.send() to use total payload size instead of just attachment size

- Update Drafts.create() and Drafts.update() to use total payload size

- Add comprehensive tests to verify the fix works correctly

- Maintain full backwards compatibility

Fixes: Requests failing when total payload exceeds 3MB despite small attachments
@AaronDDM AaronDDM merged commit 7548028 into main Jun 4, 2025
5 checks passed
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.

3 participants