Symfony 8.2 Adds Per-Transport Mail Limits and Safer Webhook Delivery
- Javier Eguiluz
- 310 reads
Symfony 8.2 adds independent mail rate limits, configurable SMTP timeouts, standard webhook signatures and controls for private network targets.

Symfony 8.2 gives teams more control over how mail and webhook traffic behaves in production. The practical changes span separate rate limits for mail transports, shorter SMTP timeouts, broader email header support, and new webhook signing and destination controls. Several additions also make it easier to route events across accounts and track SMS engagement.

Mail limits and SMTP behavior
Applications that send through multiple email providers often face different sending quotas. Before Symfony 8.2, rate limiting asynchronous email through Messenger applied to the Messenger transport as a whole. That could not express separate limits for, say, newsletters and billing messages when each provider had its own quota.

Now each Mailer transport can reference a distinct rate limiter. A team can set a fixed window of 500 newsletter emails per 60 minutes and 50 billing emails in the same interval, while leaving an alerts transport without a limit. This makes application-level settings align more closely with provider-specific constraints.

When a transport reaches its configured ceiling, Symfony throws RateLimitExceededException. With Messenger, the email is retried when the limiter allows sending again, while the worker can continue processing mail for other transports. Synchronous callers need to catch the exception themselves. A rate limit is treated as a sending constraint rather than a transport failure, so it does not trigger the configured failover transport.

SMTP connections also gain a per-transport timeout through the smtp:// and smtps:// DSNs. Previously, SMTP used PHP’s default_socket_timeout, which defaults to 60 seconds, with no way to tune an individual transport. The new timeout parameter accepts seconds, including decimal values such as 2.5, and governs connection setup as well as subsequent reads and writes. For workers waiting on an unresponsive mail server, this offers a direct way to limit how long a send can block.

More control over email representation
Symfony’s Mime component can now represent address groups in email headers. A group has a name and can contain zero or more addresses, matching the format used for headers such as To, Cc, Bcc, Reply-To, and, as specified by RFC 6854, From. An empty group can produce a header such as To: undisclosed-recipients:; while the actual recipients are listed as blind copies.

Groups are added through the header API because the familiar to() and cc() methods continue to accept addresses. Existing code that reads recipients through methods such as getTo() still receives Address objects, including group members. There is one transport distinction to account for: SMTP preserves group formatting, while API transports send the addresses and omit the group name.

For MIME parts, developers can explicitly select binary content transfer encoding to send raw content without quoted-printable, base64, or 8bit encoding. Symfony won’t choose this encoding automatically. SMTP can carry binary content only when the server supports the BINARYMIME extension, and Symfony does not check for that capability, so this setting suits delivery paths whose behavior is under the application team’s control.
Webhook signatures and destination controls
Symfony’s earlier webhook signature format was specific to Symfony, leaving teams using other stacks to implement their own verification. Symfony 8.2 adds support for the Standard Webhooks specification, which has verification libraries in many programming languages. Outgoing webhooks now include a Webhook-Timestamp header, and configuration can choose the legacy, standard, or transitional signature format.
The standard signature covers the webhook ID, timestamp, and body. Including the timestamp lets receivers reject old deliveries that have been captured and replayed. The event name moves from a header into the payload’s type field, because headers are not part of that signature format. A configurable timestamp tolerance controls how far a delivery may differ from the current time; the documented default is 300 seconds.
The transitional mode supports a staged migration: receivers can first accept either format, senders can then switch to standard signatures, and receivers can move to standard-only verification afterward. That sequence allows systems on different stacks to update without requiring every sender and receiver to change at once.
Webhook destinations can also be restricted to avoid sending requests to private network addresses. Since subscribers supply destination URLs, a URL could otherwise point to an internal server. The new no_private_network option wraps the sending client with NoPrivateNetworkHttpClient, which also guards against redirects and DNS tricks. Teams can provide an allow list for private IPs or subnets that should remain reachable. The option is disabled by default because some applications intentionally deliver webhooks within their own networks. Symfony 8.2 also adds framework.webhook.http_client for selecting the HTTP client service used for webhook delivery.
Event routing and SMS engagement
Applications that receive events for multiple accounts of one service can now attach the repeatable #[AsRemoteEventConsumer] attribute several times to the same consumer class. Each account can retain its own webhook routing entry and secret, while a shared consumer handles the events. This is useful when account separation is required for credentials, but the processing logic is the same.
The RemoteEvent component also adds SmsEvent::CLICKED and SmsEvent::UNSUBSCRIBED alongside existing delivered and failed SMS events. Consumers can use these names to track link clicks or remove a phone number from SMS campaigns after an unsubscribe request. At this release, only the Sweego bridge maps its webhooks to the two new events, so support depends on the provider bridge in use.
Taken together, the changes focus on operational control and interoperability: mail limits can match provider quotas, SMTP waits can be bounded, and webhook signatures can be shared across frameworks. Teams adopting the new options should check transport behavior and bridge support as part of rollout, especially for binary MIME and SMS engagement events.