From 4dc96daeb3c028d35b06ab73db7a3709659a6378 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 13 Nov 2022 02:28:06 -0500 Subject: [PATCH] mail() requires additional headers to be separated by CRLF - Rewrite Email->getAdditionalMailHeaderString to have only one string concatenation statement --- src/Object/Email.php | 13 +++++++------ src/Util/Emailer.php | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Object/Email.php b/src/Object/Email.php index 28d46f50a3..57eb0c17e9 100644 --- a/src/Object/Email.php +++ b/src/Object/Email.php @@ -135,14 +135,15 @@ class Email implements IEmail $headerString = ''; foreach ($this->additionalMailHeader as $name => $values) { - if (is_array($values)) { - foreach ($values as $value) { - $headerString .= "$name: $value\n"; - } - } else { - $headerString .= "$name: $values\n"; + if (!is_array($values)) { + $values = [$values]; + } + + foreach ($values as $value) { + $headerString .= "$name: $value\r\n"; } } + return $headerString; } diff --git a/src/Util/Emailer.php b/src/Util/Emailer.php index d045698233..81a2ac2688 100644 --- a/src/Util/Emailer.php +++ b/src/Util/Emailer.php @@ -163,9 +163,9 @@ class Emailer // generate a multipart/alternative message header $messageHeader = $email->getAdditionalMailHeaderString() . - "From: $fromName <{$fromAddress}>\n" . - "Reply-To: $fromName <{$replyTo}>\n" . - "MIME-Version: 1.0\n" . + "From: $fromName <{$fromAddress}>\r\n" . + "Reply-To: $fromName <{$replyTo}>\r\n" . + "MIME-Version: 1.0\r\n" . "Content-Type: multipart/alternative; boundary=\"{$mimeBoundary}\""; // assemble the final multipart message body with the text and html types included -- 2.39.5