[CUST-5735] feat(messages): add send_raw_mime for raw MIME message send - #488
Merged
Merged
Conversation
- add Messages.send_raw_mime() that posts to /v3/grants/{grant_id}/messages/send?type=mime
- add SendRawMimeRequest model with a mime field accepting str or bytes
- add _build_raw_mime_form_request helper that sends the MIME as a message/rfc822 file part
- add unit tests for the resource method and the form builder
- add raw_mime_send_demo example and README
- add changelog entry
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
benjaminwhtan
had a problem deploying
to
sdk-reference
September 29, 2026 17:14 — with
GitHub Actions
Failure
benjaminwhtan
had a problem deploying
to
sdk-reference
September 30, 2026 15:35 — with
GitHub Actions
Failure
1 of 3 tasks
pengfeiye
approved these changes
Sep 30, 2026
Contributor
|
this is a new feature you might need to update the sdk referrence doc AI should be able to resolve the error on the PR |
2 of 4 tasks
This branch was successfully deployed
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.
Summary
The v3 API supports sending a raw RFC 822 MIME message (
POST /v3/grants/{grant_id}/messages/send?type=mime), but the Python SDK had no way to call it. Customers who need exact control over the outgoing message, such as settingImportance: High/X-Priority: 1on Microsoft grants, had to hand-roll HTTP requests. This addsmessages.send_raw_mime().Changes
Messages.send_raw_mime(identifier, request_body, overrides=None), returningResponse[Message]. It follows the repo'srequest_bodyTypedDict convention and is named to pair with the existing read-sidefields="raw_mime".SendRawMimeRequestmodel.mimeacceptsstrorbytes. Bytes are sent exactly as given; strings are encoded as UTF-8._build_raw_mime_form_request, which sends the MIME as amessage/rfc822file part namedmime. v3-send'sconstructMimeReaderreads the file part first and streams it to disk. A plain form value only works through a fallback that logs an error, and Go's multipart parser holds plain values in memory with a size cap.type=mimeis set internally and isn't exposed as a query param, because it selects the endpoint rather than being an option.examples/raw_mime_send_demoexample and README, and a CHANGELOG entry.Testing
?type=mime, amultipart/form-databody with a singlemimefile part, and bytes unchangedImportance: HighandX-Priority: 1in the message source.Related
🤖 Generated with Claude Code