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/Amazon/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
---

* Add support for `X-SES-MESSAGE-TAGS`
* Add support for custom ses+smtp hosts

6.0
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ public function createProvider(): iterable
new Dsn('ses+smtps', 'default', self::USER, self::PASSWORD, null, ['region' => 'eu-west-1', 'ping_threshold' => '10']),
(new SesSmtpTransport(self::USER, self::PASSWORD, 'eu-west-1', $dispatcher, $logger))->setPingThreshold(10),
];

yield [
new Dsn('ses+smtp', 'custom.vpc.endpoint', self::USER, self::PASSWORD, null, ['region' => 'eu-west-1']),
new SesSmtpTransport(self::USER, self::PASSWORD, 'eu-west-1', $dispatcher, $logger, 'custom.vpc.endpoint'),
];

yield [
new Dsn('ses+smtps', 'custom.vpc.endpoint', self::USER, self::PASSWORD, null, ['region' => 'eu-west-1']),
new SesSmtpTransport(self::USER, self::PASSWORD, 'eu-west-1', $dispatcher, $logger, 'custom.vpc.endpoint'),
];
}

public function unsupportedSchemeProvider(): iterable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ class SesSmtpTransport extends EsmtpTransport
/**
* @param string|null $region Amazon SES region
*/
public function __construct(string $username, #[\SensitiveParameter] string $password, string $region = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
public function __construct(string $username, #[\SensitiveParameter] string $password, string $region = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null, string $host = 'default')
{
parent::__construct(sprintf('email-smtp.%s.amazonaws.com', $region ?: 'eu-west-1'), 465, true, $dispatcher, $logger);
if ('default' === $host) {
$host = sprintf('email-smtp.%s.amazonaws.com', $region ?: 'eu-west-1');
}

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

$this->setUsername($username);
$this->setPassword($password);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function create(Dsn $dsn): TransportInterface
$region = $dsn->getOption('region');

if ('ses+smtp' === $scheme || 'ses+smtps' === $scheme) {
$transport = new SesSmtpTransport($this->getUser($dsn), $this->getPassword($dsn), $region, $this->dispatcher, $this->logger);
$transport = new SesSmtpTransport($this->getUser($dsn), $this->getPassword($dsn), $region, $this->dispatcher, $this->logger, $dsn->getHost());

if (null !== $pingThreshold = $dsn->getOption('ping_threshold')) {
$transport->setPingThreshold((int) $pingThreshold);
Expand Down