8000 [Mailer][Resend] Fix compatibility with resend template by Orkin · Pull Request #63196 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@Orkin
Copy link
Contributor
@Orkin Orkin commented Jan 26, 2026
Q A
Branch? 7.3
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #...
License MIT

Implementation of ReSend template is not compatible with ReSend API : https://resend.com/docs/dashboard/templates/introduction
I used the same way that it's handle for Brevo

@Orkin Orkin force-pushed the fix/resend-template-id branch from 45b42ba to 8b21821 Compare January 27, 2026 09:40
@Orkin
Copy link
Contributor Author
Orkin commented Jan 27, 2026

@nicolas-grekas do I need to create an issue to not forget to remove unused / deprecated params for 8.4 and 9.0 ?

@Orkin Orkin requested a review from welcoMattic January 27, 2026 09:41
@Orkin Orkin force-pushed the fix/resend-template-id branch from 8b21821 to c47347d Compare January 27, 2026 10:08
@Orkin Orkin requested a review from welcoMattic January 27, 2026 10:09
}

if ('params' === $name) {
trigger_deprecation('symfony/resend-mailer', '7.3', 'Usage of params is deprecated use variables instead.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
trigger_deprecation('symfony/resend-mailer', '7.3', 'Usage of params is deprecated use variables instead.');
trigger_deprecation('symfony/resend-mailer', '7.3', 'The "params" header name is deprecated, use the "variables" header name instead');

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No deprecation can be added here, these must be postponed to 8.1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, my bad.

The bug fix is only about transforming ['templateId'] into ['template']['id'] and params into ['templates']['variables'] in this PR, targeting 7.3. Users can still continue to call headers templateId and params

Then another PR, targeting 8.1, to add the deprecation trigger when usage of params header name is detected, to inform users to use variables header name instead.

Am I right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the bug can allow using variables headers too to match with the documentation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepting the new variables header name is considered as a new feature from Symfony user point of view. The bug fix is limited to match what Resend API expect, not to introduce something new to Symfony users. In other words, fixing the bug must be transparent to Symfony users in 7.3. Then for 8.1, you can introduce the new variables header name and deprecate the params one to align naming between Resend API documentation and Symfony Resend Bride source code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I understand so I should make an other PR with this with target branch symfony 8.1 right ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly.

This one targeting 7.3, only to transform header names to match what Resend API expect.

Another one targeting 8.1, to introduce params header name deprecation and add support to variables header name instead.

@welcoMattic welcoMattic changed the title [Mailer][ReSend] Fix compatibility with resend template [Mailer][Resend] Fix compatibility with resend template Jan 28, 2026
@stof
Copy link
Member
stof commented Jan 28, 2026

-1 for this. This PR is adding new features to give a special meaning to some header names in the ResendTransport, which are not part of the symfony/mailer abstraction. We already rejected similar attempts in the past for other bridges when trying to turn them into SDKs supporting all features of the API:

  • it creates hidden restrictions on a specific bridge in code instead of properly using symfony/mailer in the intended way
  • it creates a maintenance nightmare as those specific features of a bridge would still have a BC impact (and they could have an impact on the component itself due to the way they hack their features into the abstraction)

@stof
Copy link
Member
stof commented Jan 28, 2026

Thus, this PR is not actually fixing a bug. It implements a new feature by adding a special meaning for some header names that were handled as normal headers until now.

@Orkin
Copy link
Contributor Author
Orkin commented Jan 28, 2026

I'm sorry but for me it's a bug fix, the tests assume that there is a params and templateid. It was just not put in the right place. In Resend api documentation there is no need for templateid and params as string in the headers.

That's why for me it's a bugfix because providing them do nothing

@stof
Copy link
Member
stof commented Jan 28, 2026

The tests don't assume that those work to configure the template setting of the Resend API. The existing test assertion is covering the fact that you can submit such header.

There has never been a version of Symfony shipping a working way to configure the template setting of Resend. And such template support is not in the contract of transports in mailer (it is even explicitly out of scope).
Adding a hacky way to configure the template setting by repurposing headers (and so forbidding to send an email with a header with that name) is definitely not a bugfix to me.

@Orkin
Copy link
Contributor Author
Orkin commented Jan 28, 2026

@stof Ok I understand, so maybe it could be interesting to rename the name of thoses parameters to avoid misunderstanding from the template parameter name that match provider feature ?

I can make a PR to change that

@stof
Copy link
Member
stof commented Jan 28, 2026

I suggest changing the test to use names than don't cause confusion about whether this feature is supported or no indeed. This is a test about covering custom headers, as said by the test name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

0