feat(email): wire MessageIdUtil into EmailTemplates + signed Reply-To#22
Open
mpge wants to merge 1 commit intofeat/email-message-idfrom
Open
feat(email): wire MessageIdUtil into EmailTemplates + signed Reply-To#22mpge wants to merge 1 commit intofeat/email-message-idfrom
mpge wants to merge 1 commit intofeat/email-message-idfrom
Conversation
…y-To Refactors EmailTemplates (NewTicket / TicketReply / SlaBreachAlert) to delegate Message-ID generation to MessageIdUtil (added in #21) so the format matches the canonical NestJS reference: before: <{ticket.Reference}@escalated> <{ticket.Reference}-reply-{reply.Id}@escalated> <{ticket.Reference}-sla-{breachType}@escalated> after: <ticket-{id}@{domain}> <ticket-{id}-reply-{replyId}@{domain}> The hardcoded '@escalated' pseudo-domain is replaced with the new EmailOptions.Domain config value. Every template now takes an EmailOptions parameter so the domain + secret don't have to be baked into call sites. Adds EmailOptions config: EscalatedOptions.Email.Domain (default: 'localhost') EscalatedOptions.Email.InboundSecret (default: empty — Reply-To skipped) Adds EmailMessage.ReplyTo for the signed Reply-To address (reply+{id}.{hmac8}@{domain}) which inbound provider webhooks verify via MessageIdUtil.VerifyReplyTo to route inbound mail back to its ticket even when clients strip the Message-ID / In-Reply-To chain. 6 new xUnit tests cover the format, thread headers, signed Reply-To presence/absence, and the default-option values.
This was referenced Apr 24, 2026
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
EmailTemplates.NewTicket/TicketReply/SlaBreachAlertto delegate Message-ID generation toMessageIdUtil(added in #21) so the format matches the canonical NestJS reference, and adds a signed Reply-To header so inbound provider webhooks can verify ticket identity.Format change
<{ticket.Reference}@escalated><ticket-{id}@{domain}><{ticket.Reference}-reply-{reply.Id}@escalated><ticket-{id}-reply-{replyId}@{domain}><{ticket.Reference}-sla-{breachType}@escalated>In-Reply-To + Referencespoint at ticket rootThe hardcoded
@escalatedpseudo-domain is replaced with the newEmailOptions.Domainconfig value. Every template now takes anEmailOptionsparameter so the domain + secret don't have to be baked into call sites.Config
Host apps with the default DI wiring resolve
IOptions<EscalatedOptions>and passoptions.Value.Emailto the templates.EmailMessage.ReplyTo
New nullable
ReplyToproperty onEmailMessageholds the signedreply+{id}.{hmac8}@{domain}address (ornullwhenInboundSecretis blank). Inbound provider webhooks verify viaMessageIdUtil.VerifyReplyToto route replies back to their ticket even when clients strip the Message-ID chain.Dependencies
feat/email-message-id). Will rebase ontomainonce feat(email): add MessageIdUtil for RFC 5322 threading + signed Reply-To #21 merges.Test plan