-
-
Notifications
You must be signed in to change notification settings - Fork 834
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add drivers for Mailgun, Mandrill, SES (#1169)
- Loading branch information
1 parent
8c65316
commit c50d58d
Showing
4 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Flarum. | ||
* | ||
* (c) Toby Zerner <toby.zerner@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Flarum\Mail; | ||
|
||
use Flarum\Settings\SettingsRepositoryInterface; | ||
use GuzzleHttp\Client; | ||
use Illuminate\Mail\Transport\MailgunTransport; | ||
use Swift_Transport; | ||
|
||
class MailgunDriver implements DriverInterface | ||
{ | ||
public function buildTransport(SettingsRepositoryInterface $settings): Swift_Transport | ||
{ | ||
return new MailgunTransport( | ||
new Client(['connect_timeout' => 60]), | ||
$settings->get('mail_mailgun_secret'), | ||
$settings->get('mail_mailgun_domain') | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Flarum. | ||
* | ||
* (c) Toby Zerner <toby.zerner@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Flarum\Mail; | ||
|
||
use Flarum\Settings\SettingsRepositoryInterface; | ||
use GuzzleHttp\Client; | ||
use Illuminate\Mail\Transport\MandrillTransport; | ||
use Swift_Transport; | ||
|
||
class MandrillDriver implements DriverInterface | ||
{ | ||
public function buildTransport(SettingsRepositoryInterface $settings): Swift_Transport | ||
{ | ||
return new MandrillTransport( | ||
new Client(['connect_timeout' => 60]), | ||
$settings->get('mail_mandrill_secret') | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Flarum. | ||
* | ||
* (c) Toby Zerner <toby.zerner@gmail.com> | ||
* | ||
* For the full 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\Mail\Transport\SesTransport; | ||
use Swift_Transport; | ||
|
||
class SesDriver implements DriverInterface | ||
{ | ||
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)); | ||
} | ||
} |