aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/settings/lib/Settings/Admin/Mail.php1
-rw-r--r--apps/settings/tests/Settings/Admin/MailTest.php1
-rw-r--r--lib/private/Mail/Mailer.php5
-rw-r--r--tests/lib/Mail/MailerTest.php3
4 files changed, 8 insertions, 2 deletions
diff --git a/apps/settings/lib/Settings/Admin/Mail.php b/apps/settings/lib/Settings/Admin/Mail.php
index 1cdb7315713..906fdf931eb 100644
--- a/apps/settings/lib/Settings/Admin/Mail.php
+++ b/apps/settings/lib/Settings/Admin/Mail.php
@@ -28,6 +28,7 @@
namespace OCA\Settings\Settings\Admin;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\IBinaryFinder;
use OCP\IConfig;
use OCP\IL10N;
use OCP\Settings\IDelegatedSettings;
diff --git a/apps/settings/tests/Settings/Admin/MailTest.php b/apps/settings/tests/Settings/Admin/MailTest.php
index c3b08a9d509..8fe5bda4d4f 100644
--- a/apps/settings/tests/Settings/Admin/MailTest.php
+++ b/apps/settings/tests/Settings/Admin/MailTest.php
@@ -30,6 +30,7 @@ namespace OCA\Settings\Tests\Settings\Admin;
use OCA\Settings\Settings\Admin\Mail;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\IBinaryFinder;
use OCP\IConfig;
use OCP\IL10N;
use Test\TestCase;
diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php
index 2839c1c504e..4cd523ba414 100644
--- a/lib/private/Mail/Mailer.php
+++ b/lib/private/Mail/Mailer.php
@@ -361,8 +361,10 @@ class Mailer implements IMailer {
break;
default:
$sendmail = \OCP\Server::get(IBinaryFinder::class)->findBinaryPath('sendmail');
- if ($sendmail === null) {
+ if ($sendmail === false) {
+ // fallback (though not sure what good it'll do)
$sendmail = '/usr/sbin/sendmail';
+ $this->logger->debug('sendmail binary search failed, using fallback ' . $sendmail, ['app' => 'core']);
}
$binaryPath = $sendmail;
break;
@@ -373,6 +375,7 @@ class Mailer implements IMailer {
default => ' -bs',
};
+ $this->logger->debug('Using sendmail binary: ' . $binaryPath, ['app' => 'core']);
return new SendmailTransport($binaryPath . $binaryParam, null, $this->logger);
}
}
diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php
index e3995fd17be..5e8993f10ea 100644
--- a/tests/lib/Mail/MailerTest.php
+++ b/tests/lib/Mail/MailerTest.php
@@ -16,6 +16,7 @@ use OC\Mail\Mailer;
use OC\Mail\Message;
use OCP\Defaults;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\IBinaryFinder;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
@@ -90,7 +91,7 @@ class MailerTest extends TestCase {
['mail_sendmailmode', 'smtp', $sendmailMode],
]);
- $path = \OC_Helper::findBinaryPath('sendmail');
+ $path = \OCP\Server::get(IBinaryFinder::class)->findBinaryPath('sendmail');
if ($path === false) {
$path = '/usr/sbin/sendmail';
}