Skip to content

Commit

Permalink
Guess dkim domain automatically (#23)
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Jahn <[email protected]>
  • Loading branch information
fjahn authored Apr 25, 2024
1 parent cc20f9c commit ece7738
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion config/dkim.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
declare(strict_types=1);

return [
'enabled' => env('DKIM_ENABLED', true),
'private_key' => env('DKIM_PRIVATE_KEY', storage_path('app/dkim/private_key.txt')),
'selector' => env('DKIM_SELECTOR', 'default'),
'domain' => env('DKIM_DOMAIN', null),
'domain' => env('DKIM_DOMAIN', parse_url(config('app.url'))['host']),
'passphrase' => env('DKIM_PASSPHRASE', ''),
'algorithm' => env('DKIM_ALGORITHM', 'rsa-sha256'),
'identity' => env('DKIM_IDENTITY', null),
Expand Down
6 changes: 3 additions & 3 deletions src/DKIMMailServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ private function publishesConfig(): void
protected function registerIlluminateMailer()
{
$this->app->singleton('mail.manager', static function (Application $app) {
if (config('dkim.domain') === null) {
return new \Illuminate\Mail\MailManager($app);
if (config('dkim.enabled', true) && config('dkim.domain') !== null) {
return new MailManager($app);
}
return new MailManager($app);
return new \Illuminate\Mail\MailManager($app);
});

$this->app->bind('mailer', static function (Application $app) {
Expand Down

0 comments on commit ece7738

Please sign in to comment.