]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/EMailer/MailBuilder.php
Merge pull request #9261 from annando/relay-distribution
[friendica.git] / src / Util / EMailer / MailBuilder.php
index 6a7412f683d74c7356ed91897667cae9b64270db..38970a612d590c2078b5f50c5d3fe350f0af145f 100644 (file)
@@ -159,6 +159,36 @@ abstract class MailBuilder
                return $this;
        }
 
+       /**
+        * Returns the current headers
+        *
+        * @return string[][]
+        */
+       public function getHeaders()
+       {
+               return $this->headers;
+       }
+
+       /**
+        * Sets the headers
+        *
+        * Expected format is
+        * [
+        *   'Header1' => ['value1', 'value2', ...],
+        *   'Header2' => ['value3', 'value4', ...],
+        *   ...
+        * ]
+        *
+        * @param string[][] $headers
+        * @return $this
+        */
+       public function withHeaders(array $headers)
+       {
+               $this->headers = $headers;
+
+               return $this;
+       }
+
        /**
         * Adds a value to a header
         *
@@ -184,8 +214,7 @@ abstract class MailBuilder
         */
        public function setHeader(string $name, string $value)
        {
-               $this->headers[$name] = [];
-               $this->headers[$name][] = $value;
+               $this->headers[$name] = [$value];
 
                return $this;
        }