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
Blocks
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 stripsMessage-IDbefore the API call, andmail_send_logs.message_idstaysnullon 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.ProviderMessageIdReaderimplementation 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: theinternetMessageIdof the item in Sent Items).read_back_provider_idswitch — off by default, on for the Graph route.mail_send_logs.message_id(the RFC 5322 id read from the sent copy) and/orprovider_reference.sent/suppressedwith the id leftnull, as today.Acceptance criteria
read_back_provider_id, off by defaultnulland does not raiseMessage-IDare unaffectedBlocks