minor #39463 [Mailer] [Amazon] Ensure "ext-simplexml" is loaded if SesApiTransport is used (OskarStark)

This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Mailer] [Amazon] Ensure "ext-simplexml" is loaded if SesApiTransport is used

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | ---
| License       | MIT
| Doc PR        | ---

For reference:
150d8506e4/src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesApiTransport.php (L66-L69)

Commits
-------

a40d1375f9 [Mailer] [Amazon] Ensure "ext-simplexml" is loaded if SesApiTransport is used
This commit is contained in:
Jérémy Derussé 2020-12-14 21:27:32 +01:00
commit e96b0e7d4d
No known key found for this signature in database
GPG Key ID: 2083FA5758C473D2
1 changed files with 5 additions and 0 deletions

View File

@ -11,6 +11,7 @@
namespace Symfony\Component\Mailer\Bridge\Amazon\Transport;
use Symfony\Component\Mailer\Exception\LogicException;
use Symfony\Component\Mailer\Exception\UnsupportedSchemeException;
use Symfony\Component\Mailer\Transport\AbstractTransportFactory;
use Symfony\Component\Mailer\Transport\Dsn;
@ -31,6 +32,10 @@ final class SesTransportFactory extends AbstractTransportFactory
$port = $dsn->getPort();
if ('ses+api' === $scheme) {
if (!\extension_loaded('simplexml')) {
throw new LogicException(sprintf('Cannot use "%s". Make sure you have "ext-simplexml" installed and enabled.', SesApiTransport::class));
}
return (new SesApiTransport($user, $password, $region, $this->client, $this->dispatcher, $this->logger))->setHost($host)->setPort($port);
}