feat(mail): wire Message_Id_Util into Email_Threading + add signed Reply-To#32
Open
mpge wants to merge 1 commit intofeat/email-message-idfrom
Open
feat(mail): wire Message_Id_Util into Email_Threading + add signed Reply-To#32mpge wants to merge 1 commit intofeat/email-message-idfrom
mpge wants to merge 1 commit intofeat/email-message-idfrom
Conversation
…ply-To Refactors Email_Threading to delegate Message-ID generation to Message_Id_Util (added in #31) so the format matches the canonical NestJS reference and inbound Reply-To verification has something to check against. Format change: before: reply-{id}-ticket-{reference}@{domain} after: <ticket-{id}@{domain}> (anchor) <ticket-{id}-reply-{reply_id}@{domain}> (reply) Adds signed Reply-To to outbound mail headers when an inbound secret is configured. The HMAC prefix on the local part means inbound provider webhooks can route replies by ticket id without trusting the mail client's threading headers. New WP options (preferred over constants): escalated_email_domain — right-hand side of Message-IDs escalated_email_inbound_secret — HMAC key (empty → Reply-To skipped) Falls back to ESCALATED_EMAIL_DOMAIN / ESCALATED_EMAIL_INBOUND_SECRET PHP constants, then site_url() host, then 'localhost'. Updates existing test_generate_ticket_message_id / test_generate_reply_message_id assertions for the new format. Adds 4 new tests for the signed Reply-To path (blank / configured, via direct helper call and via add_threading_headers integration).
2 tasks
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
Refactors
Email_Threadingto delegate Message-ID generation toMessage_Id_Util(added in #31) so the format matches the canonical NestJS reference and inbound Reply-To verification has something to check against.Format change
ticket-{pk}-{reference}@{domain}(without angle brackets)<ticket-{id}@{domain}>reply-{id}-ticket-{reference}@{domain}<ticket-{id}-reply-{reply_id}@{domain}>This is a breaking format change. Existing emails already sent stay as-is; new outbound mail uses the util's format, which is what inbound adapters will parse to route replies.
Signed Reply-To
add_threading_headers()now appendsReply-To: reply+{id}.{hmac8}@{domain}to the outbound headers when an inbound secret is configured. Inbound provider webhooks verify the 8-char HMAC-SHA256 prefix before routing replies.Config
New WP options (preferred over constants):
escalated_email_domain— right-hand side of Message-IDsescalated_email_inbound_secret— HMAC key (empty → Reply-To skipped)Fallback order: option →
ESCALATED_EMAIL_DOMAIN/_SECRETPHP constants →site_url()host →localhost.Dependencies
feat/email-message-id). Will rebase ontomainonce feat(email): add Message_Id_Util for RFC 5322 threading + signed Reply-To #31 merges.Test plan
test_generate_ticket_message_id/test_generate_reply_message_id/test_add_threading_headers_for_ticketassertions updated for the new formatadd_threading_headersintegration)lint+test (8.1)+test (8.2))