mirror of
https://github.com/flarum/framework.git
synced 2025-02-11 15:22:00 +08:00
Removed support for SES Mail Driver (#2011)
This commit is contained in:
parent
9ef640fa44
commit
ccf11480bf
|
@ -26,7 +26,6 @@ class MailServiceProvider extends AbstractServiceProvider
|
|||
'mailgun' => MailgunDriver::class,
|
||||
'mandrill' => MandrillDriver::class,
|
||||
'log' => LogDriver::class,
|
||||
'ses' => SesDriver::class,
|
||||
'smtp' => SmtpDriver::class,
|
||||
];
|
||||
});
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Mail;
|
||||
|
||||
use Aws\Ses\SesClient;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Contracts\Validation\Factory;
|
||||
use Illuminate\Mail\Transport\SesTransport;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use Swift_Transport;
|
||||
|
||||
class SesDriver implements DriverInterface
|
||||
{
|
||||
public function availableSettings(): array
|
||||
{
|
||||
return [
|
||||
'mail_ses_key' => '',
|
||||
'mail_ses_secret' => '',
|
||||
'mail_ses_region' => '',
|
||||
];
|
||||
}
|
||||
|
||||
public function validate(SettingsRepositoryInterface $settings, Factory $validator): MessageBag
|
||||
{
|
||||
return $validator->make($settings->all(), [
|
||||
'mail_ses_key' => 'required',
|
||||
'mail_ses_secret' => 'required',
|
||||
'mail_ses_region' => 'required',
|
||||
])->errors();
|
||||
}
|
||||
|
||||
public function canSend(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function buildTransport(SettingsRepositoryInterface $settings): Swift_Transport
|
||||
{
|
||||
$config = [
|
||||
'version' => 'latest',
|
||||
'service' => 'email',
|
||||
'region' => $settings->get('mail_ses_region'),
|
||||
'credentials' => [
|
||||
'key' => $settings->get('mail_ses_key'),
|
||||
'secret' => $settings->get('mail_ses_secret'),
|
||||
],
|
||||
];
|
||||
|
||||
return new SesTransport(new SesClient($config));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user