Skip to content

fix: Mailgun reply-to header and named 'to' recipient support#16

Open
deepshekhardas wants to merge 5 commits into
mainfrom
fix/mailgun-reply-to-header
Open

fix: Mailgun reply-to header and named 'to' recipient support#16
deepshekhardas wants to merge 5 commits into
mainfrom
fix/mailgun-reply-to-header

Conversation

@deepshekhardas
Copy link
Copy Markdown
Owner

@deepshekhardas deepshekhardas commented May 14, 2026

Summary

Fixes the Mailgun adapter to properly handle Reply-To header and adds support for named recipients in the 'to' field.

Changes

  1. Fix h:Reply-To header - The header was missing => operator, causing Reply-To to be silently ignored
  2. Add named 'to' recipients - Support ['email' => '...', 'name' => '...'] format matching cc/bcc
  3. Fix from address format - RFC 5322 compliant "Name <email>" format

Related Issue

This addresses the P1 bug found in PR utopia-php#114 where the Mailgun h:Reply-To entry was a numeric-indexed value instead of a keyed header.


Summary by cubic

Fixes Mailgun Reply-To handling and recipient formatting. Adds new SMS adapters and a Messenger for automatic failover to improve delivery and error visibility.

  • New Features

    • Added SMS adapters: Alibaba Cloud, Vonage Messages API, and Vonage Legacy.
    • Introduced Messenger class to try multiple adapters in sequence with failover.
    • Added tests for new adapters and failover behavior.
  • Bug Fixes

    • Mailgun: send h:Reply-To correctly, support named to recipients, and use RFC 5322-compliant from format.
    • Vonage/Msg91: improved error parsing and validation (e.g., empty recipient checks).
    • Alibaba Cloud: send signature and params in the URL query string as required by the API.

Written for commit ec8380b. Summary will update on new commits.

deepshekhardas added 5 commits March 16, 2026 17:56
Alibaba SMS signature validation requires query parameters, not body.
Moved signature params from request body to URL query string.

Identified by cubic (cubic.dev)
…ages API adapter

- Add Utopia\Messaging\Messenger class for automatic failover across multiple adapters
  - Accepts single Adapter or Adapter[]
  - Tries adapters sequentially on exception
  - Validates adapter compatibility (same type and message type)
  - Returns first successful response or throws aggregated exception

- Add VonageMessages adapter using Vonage Messages API (v1)
  - Uses Basic auth (Base64 encoded API Key:Secret)
  - JSON body with channel: SMS, message_type: text
  - Treats HTTP 202 as delivered

- Rename Vonage to VonageLegacy (legacy SMS API)
  - Keeps backwards compatibility for existing users

- Add tests: MessengerTest (14 cases), VonageMessagesTest, VonageLegacyTest
- Fix h:Reply-To header missing '=>' operator (was being ignored)
- Add support for named recipients in 'to' field (matching cc/bcc format)
- Fix from address format to RFC 5322 (space before <)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant