Skip to content

[Mailer] Support region in sendgrid bridge on Symfony 6.4 #59960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
GuiForce opened this issue Mar 12, 2025 · 13 comments
Open

[Mailer] Support region in sendgrid bridge on Symfony 6.4 #59960

GuiForce opened this issue Mar 12, 2025 · 13 comments
Labels

Comments

@GuiForce
Copy link

GuiForce commented Mar 12, 2025

Description

Hello,

With the new European serveur used in Sendgrid, the Sendgrid mailer doesn't support region param in Symfony 6.4. I found a MR to add this region param on Symfony mailer 7.2.
It is possible to merge this code on Symfony 6.4 to handle Sendgrid region param ?
Thank you very much.

@alexandre-daubois
Copy link
Member

alexandre-daubois commented Mar 12, 2025

Do you mean that the bridge in 6.4 doesn't work at all anymore with something that changed on their side, or do you wish the feature was back ported so you can use it in 6.4?

In the second case, I don't think this will happen as features are never back ported. But if the bridge actually can't work anymore, this may be something to discuss.

@GuiForce
Copy link
Author

I understand your question. To be precise, the Symfony 6.4 bridge still works with SendGrid, but only for US servers. The problem arises when trying to use SendGrid's European servers, because the new SendGrid API requires region specification, a feature that is not present in version 6.4 of the Symfony bridge.

In summary:

Current operation (6.4):
The bridge works correctly for SendGrid's US servers.
It does not work for SendGrid's European servers due to the lack of region specification functionality.
My need:
I am forced to use Symfony 6.4 for technical reasons.
I need to use SendGrid's European servers. I'm not necessarily asking for a backport of the feature, but I want to point out that the issue isn't a complete malfunction of the bridge, but rather an incompatibility with the new SendGrid API requirements for European servers.

I hope this clarifies the situation.

@alexandre-daubois
Copy link
Member

So it looks like a back port of the feature and this is unlikely to happen.

Friendly ping @xabbuh to confirm?

@GuiForce
Copy link
Author

But this means that it won't be possible to use Sendgrid's European servers while remaining on Symfony 6.4 (which Sylius imposes on me).
I don't see how to work around this problem in my case.

@xabbuh
Copy link
Member

xabbuh commented Mar 14, 2025

Did that work before Sendgrid introduced the region specification?

@94noni
Copy link
Contributor

94noni commented Mar 14, 2025

perhaps you can leverage https://github.com/cweagans/composer-patches
post install of the v6.4, you patch with the new feature code
until you can upgrade your transitive dep

i've done that in the past, works "well"

@GuiForce
Copy link
Author

@xabbuh
Yes, it worked because there was no need to pass the parameter to Sendgrid.
This parameter has become mandatory to use the Sendgrid API on EU Server. Without it, you'll get a 401 error when requesting Sendgrid APIs using EU IP addresses.
But on US's one i think it did'nt change anything

@xabbuh
Copy link
Member

xabbuh commented Mar 14, 2025

If the bridge stopped working because of changes made by Sendgrid, I think we should think about a way to make it work again. IIRC we already did that in the past for other bridges.

@stof
Copy link
Member

stof commented Mar 14, 2025

The PR merged in 7.2 was about adding support for using the host of the EU region to be able to send mails with the EU region of Sendgrid. It is not adding a new parameter.
So I'm not sure about what this issue is saying. Was sendgrid allowing to send mails through an EU-based infrastructure without using the api.eu.sendgrid.com domain in the past ? My understanding is that api.sendgrid.com has always been only the US infrastructure (and there was simply no EU infrastructure in the past).

@GuiForce
Copy link
Author

I may have poorly expressed my problem. But if we use the new API api.eu.sendgrid.com, from what I understand, we must specify the region parameter. For me, the MR fix exactly matches my needs.
In fact, before, there was no European infrastructure for Sendgrid. But following the availability of this feature, my client switched to European infrastructures and finds himself stuck sending emails from his Sylius via Sendgrid.

@xabbuh
Copy link
Member

xabbuh commented Mar 14, 2025

In this case I have to correct my previous comment. I understood that the bridge wasn't no longer working because of changes being done by Sendgrid. But as I understand this now you (or your customer) also opted to use a new feature provided by Sendgrid. In this case I am not convinced that this justifies backporting #58264 to the 6.4 branch.

@stof
Copy link
Member

stof commented Mar 14, 2025

I also don't think we should backport it. If you want to benefit from a new feature of the bridge (being able to use the new European infrastructure of Sendgrid), you need to use the version of the bridge in which this feature was added. It is not a bugfix of the bridge.

@GuiForce
Copy link
Author

Unfortunately, I'm stuck in Symfony 6.4 with Sylius.
According to you, the best thing to do is to use 94noni's solution "https://github.com/cweagans/composer-patches" ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants