Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Symfony/Component/Mailer/Bridge/Sendgrid/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
---

* Add support for suppression groups via `SuppressionGroupHeader`
* Add support for `global` region

7.2
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public static function getTransportData()
new SendgridSmtpTransport('KEY', null, null, 'eu'),
'smtps://smtp.eu.sendgrid.net',
],
[
new SendgridSmtpTransport('KEY', null, null, 'global'),
'smtps://smtp.sendgrid.net',
],
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ class SendgridSmtpTransport extends EsmtpTransport
{
public function __construct(#[\SensitiveParameter] string $key, ?EventDispatcherInterface $dispatcher = null, ?LoggerInterface $logger = null, private ?string $region = null)
{
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' !== $region) {
$host = \sprintf('smtp.%s.sendgrid.net', $region);
}

parent::__construct($host, 465, true, $dispatcher, $logger);

$this->setUsername('apikey');
$this->setPassword($key);
Expand Down
Loading