Fix duplicate Reply-To header in registration & check-in emails#16
Open
ish-sookun wants to merge 1 commit into
Open
Fix duplicate Reply-To header in registration & check-in emails#16ish-sookun wants to merge 1 commit into
ish-sookun wants to merge 1 commit into
Conversation
Reply-To was being added twice on the rendered message — once via Envelope::replyTo and again when Laravel rehydrated the envelope at some point in the dispatch -> queue -> send lifecycle (Mailable's $replyTo array is appended to, not replaced). Sets the address once in the Mailable's constructor (serialized with the queued job, applied exactly once at render time) and removes replyTo from the Envelope so nothing else can push a second entry. - app/Mail/Concerns/UsesConfiguredReplyTo: trait method applyConfiguredReplyTo() that calls $this->replyTo() once - RegistrationConfirmationMail + CheckedInMail: constructor calls applyConfiguredReplyTo(); replyTo dropped from Envelope - tests/Feature/MailReplyToTest: assertions on $this->replyTo count plus a regression guard that Envelope::replyTo stays empty
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.
What was wrong
After PR #13 shipped, the registration confirmation email arrived with two identical Reply-To entries (
MSCC Developers Conference 2026, MSCC Developers Conference 2026).Root cause:
Envelope::replyTois reapplied to the Mailable's$replyToarray every time Laravel hydrates the envelope.Mailable::replyTo()appends (it doesn't replace), so any re-hydration across the dispatch → queue → send lifecycle doubles the entry.What changes
Set the configured address once, in the Mailable's constructor — serialized with the queued job, applied exactly once at render time — and drop
replyTo:from the Envelope so nothing else can push a second entry.app/Mail/Concerns/UsesConfiguredReplyTo.phpconfiguredReplyTo()(returned an Address array) toapplyConfiguredReplyTo()(calls$this->replyTo()once, void)app/Mail/RegistrationConfirmationMail.php+app/Mail/CheckedInMail.php$this->applyConfiguredReplyTo();replyTo:removed fromEnvelopetests/Feature/MailReplyToTest.php$mail->replyTocount = 1 when configured, 0 when unset; regression-guardsenvelope()->replyTo === []so a future PR can't reintroduce the bugAll 44 tests pass.
Production deploy
php artisan queue:flushif there's nothing else queued — otherwise wait for them to processTest plan
MAIL_REPLY_TO_NAME <MAIL_REPLY_TO_ADDRESS>MAIL_REPLY_TO_ADDRESS→ email has no Reply-To header at all (old behaviour preserved)