Skip to content

Microsoft Graph provider createDraft() drops cc and bcc recipients #48

@stevenobiajulu

Description

@stevenobiajulu

Summary

In packages/provider-microsoft/src/email-graph-provider.ts, createDraft(msg) builds the Graph payload with only subject, body, and toRecipients. It never reads msg.cc or msg.bcc. Any non-reply draft created via the Microsoft provider silently loses those recipients, independent of how the caller formatted the address strings.

Reproduction

await create_draft({
  mailbox: "<graph mailbox>",
  to: ["alice@example.com"],
  cc: ["bob@example.com"],
  subject: "Hello",
  body: "...",
});

Open the resulting draft in the Graph mailbox — cc is missing. No error is surfaced.

Root cause

async createDraft(msg: ComposeMessage): Promise<DraftResult> {
  const graphMsg = {
    subject: msg.subject,
    body: buildGraphBody(msg.bodyHtml, msg.body),
    toRecipients: msg.to.map(r => ({ emailAddress: { address: r.email, name: r.name } })),
  };

  const response = await this.client.post(`${this.basePath}/messages`, graphMsg);
  return { success: true, draftId: response.id };
}

No ccRecipients or bccRecipients mapping. Contrast with sendMessage in the same file, which does include both.

Expected behavior

createDraft should include ccRecipients and bccRecipients in the payload whenever msg.cc / msg.bcc are present, matching the mapping used in sendMessage.

Scope

Affects create_draft when called against a Microsoft Graph mailbox. The reply-draft path (createReplyDraft) correctly includes ccRecipients via its post-creation PATCH, so it is not affected.

Related

#47 is a broader round-trip contract bug in the action layer that also affects recipient handling. It is orthogonal — even after #47 ships, this Graph-specific drop remains until createDraft is updated to include ccRecipients / bccRecipients.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions