Skip to content

Commit

Permalink
Made sendmail command configurable
Browse files Browse the repository at this point in the history
For BookStackApp#4001
Added simple test to cover config option.
  • Loading branch information
ssddanbrown committed Feb 17, 2023
1 parent 08b3950 commit af31a6f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .env.example.complete
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/Config/mail.php
Expand Up @@ -38,7 +38,7 @@

'sendmail' => [
'transport' => 'sendmail',
'path' => '/usr/sbin/sendmail -bs',
'path' => env('MAIL_SENDMAIL_COMMAND', '/usr/sbin/sendmail -bs'),
],

'log' => [
Expand Down
5 changes: 5 additions & 0 deletions tests/Unit/ConfigTest.php
Expand Up @@ -96,6 +96,11 @@ public function test_snappy_paper_size_options_are_limited()
$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.
Expand Down

0 comments on commit af31a6f

Please sign in to comment.