From 446d96f3eb405302b75a3f0de094019dc25e5b44 Mon Sep 17 00:00:00 2001 From: Carsten Wiedmann Date: Mon, 12 Nov 2018 23:26:35 +0100 Subject: [PATCH] Apply patch from @cwiedmann but drop -oi option for pipe Signed-off-by: Daniel Kesselberg --- config/config.sample.php | 13 +++++++++++++ lib/private/Mail/Mailer.php | 11 ++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/config/config.sample.php b/config/config.sample.php index 5190e46ad7..7a86070c18 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -421,6 +421,19 @@ $CONFIG = array( */ 'mail_send_plaintext_only' => false, +/** + * Which mode is used for sendmail/qmail: ``smtp`` or ``pipe``. + * + * For ``smtp`` the sendmail binary is started with the parameter ``-bs``: + * - Use the SMTP protocol on standard input and output. + * + * For ``pipe`` the binary is started with the parameters ``-t``: + * - Read message from STDIN and extract recipients. + * + * Defaults to ``smtp`` + */ +'mail_sendmailmode' => 'smtp', + /** * Proxy Configurations */ diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php index df23b66936..7a8b4ad259 100644 --- a/lib/private/Mail/Mailer.php +++ b/lib/private/Mail/Mailer.php @@ -282,6 +282,15 @@ class Mailer implements IMailer { break; } - return new \Swift_SendmailTransport($binaryPath . ' -bs'); + switch ($this->config->getSystemValue('mail_sendmailmode', 'smtp')) { + case 'pipe': + $binaryParam = ' -t'; + break; + default: + $binaryParam = ' -bs'; + break; + } + + return new \Swift_SendmailTransport($binaryPath . $binaryParam); } }