Skip to content

Read back the provider message-id from the sent copy on the microsoftgraph route #12

Description

@jbagsik

Parent

#1

Problem

On the Microsoft Graph structured send route a sender cannot set its own RFC 5322 Message-ID — Graph builds the MIME itself and assigns its own. The transport therefore strips Message-ID before the API call, and mail_send_logs.message_id stays null on this route. The only durable identifier that survives today is the self-assigned correlation header (X-Moox-Mail-Correlation-Id). Without the provider's own message id there is no stable second key tying a sent message to its sent copy for later correlation.

What to build

After a successful send on a mailer whose transport does not stamp an on-wire Message-ID (e.g. microsoftgraph), read the provider-assigned message id back from the sent copy and store it on the log row.

  • A ProviderMessageIdReader implementation that, given the sent message, obtains the provider's message id through a follow-up lookup of the sent copy, matched by the self-assigned correlation header (for Graph: the internetMessageId of the item in Sent Items).
  • Bound per mailer and activated through the existing read_back_provider_id switch — off by default, on for the Graph route.
  • Writes the value to mail_send_logs.message_id (the RFC 5322 id read from the sent copy) and/or provider_reference.
  • A failed or absent read-back never fails the send: the row stays sent/suppressed with the id left null, as today.

Acceptance criteria

  • After a successful send on the Graph route, the sent copy's message id is stored on the log row
  • The sent copy is located by the self-assigned correlation header
  • Read-back is switchable per mailer via read_back_provider_id, off by default
  • A failed or absent read-back leaves the row successful with the id null and does not raise
  • Routes that already carry an on-wire Message-ID are unaffected

Blocks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready-for-agentSpec is ready for an agent to implement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions