Skip to content

Commit

Permalink
Replace SesTransport
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed Aug 30, 2021
1 parent 3c25dce commit b5895d8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 127 deletions.
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"pda/pheanstalk": "^4.0",
"phpunit/phpunit": "^9.4",
"predis/predis": "^1.1.2",
"symfony/amazon-mailer": "^6.0",
"symfony/cache": "^6.0",
"symfony/mailgun-mailer": "^6.0",
"symfony/postmark-mailer": "^6.0"
Expand Down Expand Up @@ -136,7 +137,7 @@
"ext-pcntl": "Required to use all features of the queue worker.",
"ext-posix": "Required to use all features of the queue worker.",
"ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).",
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.189.0).",
"aws/aws-sdk-php": "Required to use the SQS queue driver and DynamoDb failed job storage (^3.189.0).",
"brianium/paratest": "Required to run tests in parallel (^6.0).",
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.12|^3.0).",
"filp/whoops": "Required for friendly error pages in development (^2.8).",
Expand All @@ -153,9 +154,10 @@
"predis/predis": "Required to use the predis connector (^1.1.2).",
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^5.0|^6.0).",
"symfony/amazon-mailer": "Required to enable support for the SES mail transport (^6.0).",
"symfony/cache": "Required to PSR-6 cache bridge (^6.0).",
"symfony/filesystem": "Required to enable support for relative symbolic links (^6.0).",
"symfony/http-client": "Required to enable support for the Mailgun mail transport (^6.0).",
"symfony/http-client": "Required to enable support for the Symfony mail transports (^6.0).",
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.0).",
"symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.0).",
"symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0)."
Expand Down
38 changes: 10 additions & 28 deletions src/Illuminate/Mail/MailManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

namespace Illuminate\Mail;

use Aws\SesV2\SesV2Client;
use Closure;
use Illuminate\Contracts\Mail\Factory as FactoryContract;
use Illuminate\Log\LogManager;
use Illuminate\Mail\Transport\ArrayTransport;
use Illuminate\Mail\Transport\LogTransport;
use Illuminate\Mail\Transport\SesTransport;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use InvalidArgumentException;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Bridge\Amazon\Transport\SesTransportFactory;
use Symfony\Component\Mailer\Bridge\Mailgun\Transport\MailgunTransportFactory;
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
use Symfony\Component\Mailer\Transport\Dsn;
Expand Down Expand Up @@ -237,33 +236,16 @@ protected function createSendmailTransport(array $config)
*/
protected function createSesTransport(array $config)
{
$config = array_merge(
$this->app['config']->get('services.ses', []),
['version' => 'latest', 'service' => 'email'],
$config
);

$config = Arr::except($config, ['transport']);

return new SesTransport(
new SesV2Client($this->addSesCredentials($config)),
$config['options'] ?? []
);
}
$factory = new SesTransportFactory();

/**
* Add the SES credentials to the configuration array.
*
* @param array $config
* @return array
*/
protected function addSesCredentials(array $config)
{
if (! empty($config['key']) && ! empty($config['secret'])) {
$config['credentials'] = Arr::only($config, ['key', 'secret', 'token']);
}

return $config;
return $factory->create(new Dsn(
'ses+api',
'default',
$config['key'],
$config['secret'],
$config['port'] ?? null,
$config
));
}

/**
Expand Down
94 changes: 0 additions & 94 deletions src/Illuminate/Mail/Transport/SesTransport.php

This file was deleted.

6 changes: 3 additions & 3 deletions src/Illuminate/Mail/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
}
},
"suggest": {
"aws/aws-sdk-php": "Required to use the SES mail driver (^3.189.0).",
"symfony/http-client": "Required to use the Mailgun mail driver (^6.0).",
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail driver (^6.0).",
"symfony/amazon-mailer": "Required to enable support for the SES mail transport (^6.0).",
"symfony/http-client": "Required to use the Symfony mail transports (^6.0).",
"symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.0).",
"symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.0)."
},
"config": {
Expand Down

0 comments on commit b5895d8

Please sign in to comment.