]> BookStack Code Mirror - bookstack/commitdiff
Made sendmail command configurable
authorDan Brown <redacted>
Fri, 17 Feb 2023 14:25:38 +0000 (14:25 +0000)
committerDan Brown <redacted>
Fri, 17 Feb 2023 14:25:38 +0000 (14:25 +0000)
For #4001
Added simple test to cover config option.

.env.example.complete
app/Config/mail.php
tests/Unit/ConfigTest.php

index 7e6c6ee3c0d29d5ad2c24d92b7ac385f538bf13b..f81bccae4702b9ddf2eb0f903713e1956c1976c1 100644 (file)
@@ -80,6 +80,9 @@ MAIL_USERNAME=null
 MAIL_PASSWORD=null
 MAIL_ENCRYPTION=null
 
+# Command to use when email is sent via sendmail
+MAIL_SENDMAIL_COMMAND="/usr/sbin/sendmail -bs"
+
 # Cache & Session driver to use
 # Can be 'file', 'database', 'memcached' or 'redis'
 CACHE_DRIVER=file
index 9339c35c27c187f178a855c9f9f9e475f9271673..b57c152d9d8062384ca9ed38d0d14fe9386a540c 100644 (file)
@@ -38,7 +38,7 @@ return [
 
         'sendmail' => [
             'transport' => 'sendmail',
-            'path' => '/usr/sbin/sendmail -bs',
+            'path' => env('MAIL_SENDMAIL_COMMAND', '/usr/sbin/sendmail -bs'),
         ],
 
         'log' => [
index 3d15005af396e7ca7e2f6e807f11377873021a36..9966a4fb15114683393cb46e603da2e6431aa6d2 100644 (file)
@@ -96,6 +96,11 @@ class ConfigTest extends TestCase
         $this->checkEnvConfigResult('EXPORT_PAGE_SIZE', 'a4', 'snappy.pdf.options.page-size', 'A4');
     }
 
+    public function test_sendmail_command_is_configurage()
+    {
+        $this->checkEnvConfigResult('MAIL_SENDMAIL_COMMAND', '/var/sendmail -o', 'mail.mailers.sendmail.path', '/var/sendmail -o');
+    }
+
     /**
      * Set an environment variable of the given name and value
      * then check the given config key to see if it matches the given result.