Skip to content

Commit b5895d8

Browse files
committed
Replace SesTransport
1 parent 3c25dce commit b5895d8

File tree

4 files changed

+17
-127
lines changed

4 files changed

+17
-127
lines changed

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"pda/pheanstalk": "^4.0",
9191
"phpunit/phpunit": "^9.4",
9292
"predis/predis": "^1.1.2",
93+
"symfony/amazon-mailer": "^6.0",
9394
"symfony/cache": "^6.0",
9495
"symfony/mailgun-mailer": "^6.0",
9596
"symfony/postmark-mailer": "^6.0"
@@ -136,7 +137,7 @@
136137
"ext-pcntl": "Required to use all features of the queue worker.",
137138
"ext-posix": "Required to use all features of the queue worker.",
138139
"ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).",
139-
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.189.0).",
140+
"aws/aws-sdk-php": "Required to use the SQS queue driver and DynamoDb failed job storage (^3.189.0).",
140141
"brianium/paratest": "Required to run tests in parallel (^6.0).",
141142
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.12|^3.0).",
142143
"filp/whoops": "Required for friendly error pages in development (^2.8).",
@@ -153,9 +154,10 @@
153154
"predis/predis": "Required to use the predis connector (^1.1.2).",
154155
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
155156
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^5.0|^6.0).",
157+
"symfony/amazon-mailer": "Required to enable support for the SES mail transport (^6.0).",
156158
"symfony/cache": "Required to PSR-6 cache bridge (^6.0).",
157159
"symfony/filesystem": "Required to enable support for relative symbolic links (^6.0).",
158-
"symfony/http-client": "Required to enable support for the Mailgun mail transport (^6.0).",
160+
"symfony/http-client": "Required to enable support for the Symfony mail transports (^6.0).",
159161
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.0).",
160162
"symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.0).",
161163
"symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0)."

src/Illuminate/Mail/MailManager.php

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
namespace Illuminate\Mail;
44

5-
use Aws\SesV2\SesV2Client;
65
use Closure;
76
use Illuminate\Contracts\Mail\Factory as FactoryContract;
87
use Illuminate\Log\LogManager;
98
use Illuminate\Mail\Transport\ArrayTransport;
109
use Illuminate\Mail\Transport\LogTransport;
11-
use Illuminate\Mail\Transport\SesTransport;
1210
use Illuminate\Support\Arr;
1311
use Illuminate\Support\Str;
1412
use InvalidArgumentException;
1513
use Psr\Log\LoggerInterface;
14+
use Symfony\Component\Mailer\Bridge\Amazon\Transport\SesTransportFactory;
1615
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory;
1716
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
1817
use Symfony\Component\Mailer\Transport\Dsn;
@@ -237,33 +236,16 @@ protected function createSendmailTransport(array $config)
237236
*/
238237
protected function createSesTransport(array $config)
239238
{
240-
$config = array_merge(
241-
$this->app['config']->get('services.ses', []),
242-
['version' => 'latest', 'service' => 'email'],
243-
$config
244-
);
245-
246-
$config = Arr::except($config, ['transport']);
247-
248-
return new SesTransport(
249-
new SesV2Client($this->addSesCredentials($config)),
250-
$config['options'] ?? []
251-
);
252-
}
239+
$factory = new SesTransportFactory();
253240

254-
/**
255-
* Add the SES credentials to the configuration array.
256-
*
257-
* @param array $config
258-
* @return array
259-
*/
260-
protected function addSesCredentials(array $config)
261-
{
262-
if (! empty($config['key']) && ! empty($config['secret'])) {
263-
$config['credentials'] = Arr::only($config, ['key', 'secret', 'token']);
264-
}
265-
266-
return $config;
241+
return $factory->create(new Dsn(
242+
'ses+api',
243+
'default',
244+
$config['key'],
245+
$config['secret'],
246+
$config['port'] ?? null,
247+
$config
248+
));
267249
}
268250

269251
/**

src/Illuminate/Mail/Transport/SesTransport.php

Lines changed: 0 additions & 94 deletions
This file was deleted.

src/Illuminate/Mail/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
}
3838
},
3939
"suggest": {
40-
"aws/aws-sdk-php": "Required to use the SES mail driver (^3.189.0).",
41-
"symfony/http-client": "Required to use the Mailgun mail driver (^6.0).",
42-
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail driver (^6.0).",
40+
"symfony/amazon-mailer": "Required to enable support for the SES mail transport (^6.0).",
41+
"symfony/http-client": "Required to use the Symfony mail transports (^6.0).",
42+
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.0).",
4343
"symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.0)."
4444
},
4545
"config": {

0 commit comments

Comments
 (0)