]> git.mxchange.org Git - friendica.git/commitdiff
mail() requires additional headers to be separated by CRLF
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 13 Nov 2022 07:28:06 +0000 (02:28 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 13 Nov 2022 07:28:06 +0000 (02:28 -0500)
- Rewrite Email->getAdditionalMailHeaderString to have only one string concatenation statement

src/Object/Email.php
src/Util/Emailer.php

index 28d46f50a3e0fa141bae42b33f555f0326505a02..57eb0c17e9b155099521b81d23007de4016f720c 100644 (file)
@@ -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;
        }
 
index d04569823366e5dbfa8b55b76691e640aeabc404..81a2ac268872a863a717cd51ba9c084d4331b33d 100644 (file)
@@ -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