Merge pull request #4959 from turbo124/v5-develop

Fixes for newer postmark driver
This commit is contained in:
David Bomba 2021-02-22 14:40:13 +11:00 committed by GitHub
commit ced794b33a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 4 deletions

View File

@ -3,8 +3,10 @@
namespace App\Providers;
use App\Helpers\Mail\GmailTransportManager;
use Coconuts\Mail\PostmarkTransport;
use Illuminate\Mail\MailServiceProvider as MailProvider;
use Illuminate\Mail\TransportManager;
use GuzzleHttp\Client as HttpClient;
class MailServiceProvider extends MailProvider
{
@ -24,7 +26,18 @@ class MailServiceProvider extends MailProvider
$this->app->bind('mailer', function ($app) {
return $app->make('mail.manager')->mailer();
});
}
$this->app['mail.manager']->extend('postmark', function () {
return new PostmarkTransport(
$this->guzzle(config('postmark.guzzle', [])),
config('postmark.secret', config('services.postmark.secret'))
);
});
}
protected function guzzle(array $config): HttpClient
{
return new HttpClient($config);
}
}

30
config/postmark.php Normal file
View File

@ -0,0 +1,30 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Postmark credentials
|--------------------------------------------------------------------------
|
| Here you may provide your Postmark server API token.
|
*/
'secret' => env('POSTMARK_SECRET'),
/*
|--------------------------------------------------------------------------
| Guzzle options
|--------------------------------------------------------------------------
|
| Under the hood we use Guzzle to make API calls to Postmark.
| Here you may provide any request options for Guzzle.
|
*/
'guzzle' => [
'timeout' => 10,
'connect_timeout' => 10,
],
];

View File

@ -36,9 +36,6 @@ return [
'gmail' => [
'token' => '',
],
'postmark' => [
'token' => env('POSTMARK_API_TOKEN', ''),
],
'stripe' => [
'model' => App\Models\User::class,
'key' => env('STRIPE_KEY'),