Skip to content

Conversation

@sonnymilton
Copy link
Contributor

Q A
Branch? 7.4
Bug fix? no
New feature? yes
Deprecations? no
Issues Fix #61706
License MIT

This PR ensures that when the global region is provided to SendgridSmtpTransport,
the correct host smtp.sendgrid.net is used.

Previously, passing region=global resulted in the host being built as
smtp.global.sendgrid.net, which does not exist.

Why

  • DSNs like sendgrid+smtp://KEY@default?region=global failed to connect.
  • SendGrid documentation specifies that the "global" region is just smtp.sendgrid.net
    (same as when no region is provided).

How

  • Updated SendgridSmtpTransport to special-case the global region.
  • Added a unit test to cover this scenario.

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.4 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

parent::__construct(null !== $region ? \sprintf('smtp.%s.sendgrid.net', $region) : 'smtp.sendgrid.net', 465, true, $dispatcher, $logger);
$host = 'smtp.sendgrid.net';

if (null !== $region && 'global' !== strtolower($region)) {
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
if (null !== $region && 'global' !== strtolower($region)) {
if (null !== $region && 'global' !== $region) {

I don't think we need to make it case insensitive.

@fabpot fabpot force-pushed the 61706-sendgrid-global-region branch from ddb96be to 9ce7d5d Compare September 16, 2025 05:45
@fabpot
Copy link
Member

fabpot commented Sep 16, 2025

Thank you @sonnymilton.

@fabpot fabpot merged commit 9b36ddc into symfony:7.4 Sep 16, 2025
11 of 12 checks passed
@ivan-wolf
Copy link

Hi @sonnymilton, thank you for providing a fix to #61706!

Did you also check the SendgridApiTransport? It might be affected by the same problem.

@sonnymilton sonnymilton deleted the 61706-sendgrid-global-region branch September 16, 2025 14:48
fabpot added a commit that referenced this pull request Sep 17, 2025
…ansport) (sonnymilton)

This PR was merged into the 7.4 branch.

Discussion
----------

[Mailer][Sendgrid] Add support for `global` region (api transport)

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | Fix #61706
| License       | MIT

Related to #61706 and #61758
Add support for `global` region (`SendgridApiTransport`)

Commits
-------

8eb5a45 [Mailer][Sendgrid] Add support for `global` region (api transport)
This was referenced Oct 27, 2025
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.

[Mailer] SendGrid's global region is hot handled correctly in SendgridSmtpTransport

4 participants