From af31a6fc1b700df5c0a4264571946d8984ff9321 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Fri, 17 Feb 2023 14:25:38 +0000 Subject: [PATCH] Made sendmail command configurable For #4001 Added simple test to cover config option. --- .env.example.complete | 3 +++ app/Config/mail.php | 2 +- tests/Unit/ConfigTest.php | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.env.example.complete b/.env.example.complete index 7e6c6ee3c..f81bccae4 100644 --- a/.env.example.complete +++ b/.env.example.complete @@ -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 diff --git a/app/Config/mail.php b/app/Config/mail.php index 9339c35c2..b57c152d9 100644 --- a/app/Config/mail.php +++ b/app/Config/mail.php @@ -38,7 +38,7 @@ return [ 'sendmail' => [ 'transport' => 'sendmail', - 'path' => '/usr/sbin/sendmail -bs', + 'path' => env('MAIL_SENDMAIL_COMMAND', '/usr/sbin/sendmail -bs'), ], 'log' => [ diff --git a/tests/Unit/ConfigTest.php b/tests/Unit/ConfigTest.php index 3d15005af..9966a4fb1 100644 --- a/tests/Unit/ConfigTest.php +++ b/tests/Unit/ConfigTest.php @@ -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.