fix(smtp): preserve Reply-To when relaying to /v1/send - #454
Merged
driaug merged 1 commit intoAug 10, 2026
Conversation
The relay parses the incoming message and re-sends it through the API.
'reply-to' is listed in standardHeaders, so it is excluded from
customHeaders, but nothing puts it back — the request body has no reply
field. The header is parsed and then silently dropped.
Everything downstream already supports it: /v1/send accepts reply,
EmailService passes it through as replyTo, and SESService writes
'Reply-To: ${reply || from.email}'. Only the relay never populates it.
Read parsed.replyTo the same way the existing code reads parsed.from,
and pass it as the API's reply field.
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.
Problem
The SMTP relay parses each incoming message and re-sends it through
POST /v1/send.reply-tois listed instandardHeaders, so it is correctly excluded fromcustomHeaders— but nothing puts it back. The request body has noreplyfield:The header is parsed and then silently dropped. Anyone relaying transactional mail through the SMTP server loses
Reply-To, and replies go to theFromaddress instead.Everything downstream already supports it, so this is only a gap in the relay:
packages/shared— the send schema hasreply: z.ZodOptional<z.ZodString>apps/api/src/controllers/v1/Actions.ts— destructuresreplyand passes it asreplyToapps/api/src/services/EmailService.ts— forwardsreply: email.replyToapps/api/src/services/SESService.ts— writesReply-To: ${reply || from.email}into the raw MIMEEvidence
On a self-hosted install relaying ~57k transactional emails a month through the SMTP server, not one has ever carried a
Reply-To:Campaigns, which call the API directly, set it every time. Only the relay path loses it.
Fix
Read
parsed.replyTothe same way the surrounding code already readsparsed.from, and pass it through:replyis optional in the schema, so messages without aReply-Toheader are unaffected —undefinedis simply omitted from the JSON body.Notes
Reply-Topermits a list, but the API'sreplyfield is a single string, so a list would need a schema change. Taking the first address matches howfromis handled a few lines above.Reply-To.