Support multipart/alternative email sending#68
Merged
rockfordlhotka merged 7 commits intoJun 9, 2026
Conversation
- Add textBody and htmlBody parameters to SendEmailTool - Support bodyFormat "multipart" alongside existing "html" and "text" - Update IProviderService interface with new optional parameters - Update all provider implementations (M365, OutlookCom, Google, IMAP, ICS, JSON) - Google and IMAP providers use MimeKit BodyBuilder for true multipart/alternative - M365 and OutlookCom providers use HTML body (Graph API limitation) - Add validation requiring both textBody and htmlBody when multipart is specified - Add tests for HTML-only, text-only, and multipart sends - All existing tests pass unchanged
Address review feedback: replace null-forgiving operator (!) with null-coalescing operator (?? string.Empty) for safety in M365 and OutlookCom providers.
Copilot
AI
changed the title
[WIP] Add multipart/alternative email sending support
Support multipart/alternative email sending
Jun 3, 2026
…Graph multipart - Move textBody and htmlBody parameters before CancellationToken in IProviderService.SendEmailAsync and all implementations (CA1068). - Add LogWarning in M365ProviderService and OutlookComProviderService when bodyFormat is 'multipart', since the Graph SDK cannot construct a true multipart/alternative message and silently drops the plain-text body. - Update all call sites (SendEmailTool, UnsubscribeFromEmailTool) and all test mock setups/callbacks to match the new parameter order. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- docs/mcp-tools.md: document 'multipart' bodyFormat value and textBody/htmlBody parameters with M365/Outlook.com limitation note - Skills/email.md: update send_email signature and parameter descriptions - changelogs/2026-06-09-multipart-email.md: new changelog entry Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
rockfordlhotka
marked this pull request as ready for review
June 9, 2026 16:17
rockfordlhotka
deleted the
copilot/support-multipart-alternative-email-sending
branch
June 9, 2026 16:17
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.
The
send_emailtool only supported a singlebody+bodyFormat("html" or "text"), which led to formatting failures when agents mismatched content and format (e.g., sending plain text withbodyFormat: "html").Changes
textBodyandhtmlBodyonSendEmailTool.SendEmail"multipart"— requires bothtextBodyandhtmlBody; validates at the tool layer before reaching providersmultipart/alternativeMIME via MimeKitBodyBuilder(sets bothTextBodyandHtmlBody)htmlBodyas the Graph API body (Graph constructs MIME internally; no native multipart/alternative support in the SDK)body+bodyFormat: "html"/"text"behavior unchangedExample usage
{ "to": ["recipient@example.com"], "subject": "Hello", "bodyFormat": "multipart", "textBody": "Plain text fallback", "htmlBody": "<html><body><h1>Hello</h1><p>Rich content.</p></body></html>" }Documentation notes in tool descriptions
bodyFormat: "html"requires actual HTML markup"multipart"when both readable fallback text and formatted HTML are needed