From b7f1c94b97b80c592a8f75dfa8fdb181e90157ec Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 29 Jan 2020 20:09:49 +0100 Subject: [PATCH] Enigma: Fix incorrect encrypted mail structure (boundary) with Mail_Mime >= 1.10.5 --- plugins/enigma/lib/enigma_mime_message.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/enigma/lib/enigma_mime_message.php b/plugins/enigma/lib/enigma_mime_message.php index a81f3cfc6..eb6a25c2d 100644 --- a/plugins/enigma/lib/enigma_mime_message.php +++ b/plugins/enigma/lib/enigma_mime_message.php @@ -243,8 +243,6 @@ class enigma_mime_message extends Mail_mime } $this->headers = array_merge($this->headers, $headers); - - return; } else { $output = $message->encode($boundary, $skip_head); @@ -254,9 +252,16 @@ class enigma_mime_message extends Mail_mime } $this->headers = array_merge($this->headers, $output['headers']); + } - return $output['body']; + // remember the boundary used, in case we'd handle headers() call later + if (empty($boundary) && !empty($this->headers['Content-Type'])) { + if (preg_match('/boundary="([^"]+)/', $this->headers['Content-Type'], $m)) { + $this->build_params['boundary'] = $m[1]; + } } + + return $filename ? null : $output['body']; } /**