Add reply_to support to DeliveryMethod#12
Merged
benedikt merged 1 commit intouserlist:mainfrom Oct 16, 2025
Merged
Conversation
The Userlist Push API supports the reply_to parameter for messages, but the DeliveryMethod class wasn't serializing it from ActionMailer Mail objects. This commit: - Adds reply_to to the serialize method - Updates serialize_address to return nil for empty addresses - Adds comprehensive tests for both presence and absence of reply_to - Maintains backward compatibility via .compact All existing tests pass (212 examples, 0 failures).
Contributor
|
Thank you, @benjaminhouy! |
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
This PR adds support for the
reply_toemail header in theDeliveryMethodclass. The Userlist Push API already supports thereply_toparameter, but the gem'sDeliveryMethodwasn't serializing it from ActionMailerMailobjects.Changes
reply_toserialization - Theserializemethod now includesreply_to: serialize_address(mail.reply_to)serialize_addressmethod - Modified to returnnilfor empty/nil addresses instead of empty arrays, ensuring.compactworks correctlyreply_tois properly serialized when presentreply_tois omitted from payload when not present (via.compact)Backward Compatibility
This change is fully backward compatible:
serialize_addressmethod for consistency withto/fromhandling.compactto omitreply_towhen not setUse Case
This enables contact forms and other transactional emails to specify a custom reply-to address, allowing recipients to reply directly to the original sender rather than the system email address.
Example usage:
Testing
All 212 existing tests pass, plus 2 new tests specifically for
reply_tofunctionality.