From 9c09108076e4fed1bda757c4c6805f480c1de220 Mon Sep 17 00:00:00 2001
From: Markus Birth <mbirth@gmail.com>
Date: Thu, 4 Aug 2016 16:38:56 +0200
Subject: [PATCH] Move conversion of mail header array into string to
 (PHP-)MailTransport.

---
 lib/Frs/Output/MailOutput.php              | 16 +---------------
 lib/Frs/Output/Transport/MailTransport.php |  5 ++++-
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/lib/Frs/Output/MailOutput.php b/lib/Frs/Output/MailOutput.php
index a1a8a14..05de165 100644
--- a/lib/Frs/Output/MailOutput.php
+++ b/lib/Frs/Output/MailOutput.php
@@ -57,20 +57,6 @@ class MailOutput extends GenericOutput
         $this->headers[$key] = $value;
     }
 
-    /**
-     * Returns a header section (as string) of all currently set headers.
-     *
-     * @return string Header section.
-     */
-    public function getHeaders()
-    {
-        $all_headers = '';
-        foreach ($this->headers as $key=>$value) {
-            $all_headers .= $key . ': ' . $value . "\r\n";
-        }
-        return $all_headers;
-    }
-
     /**
      * Sets mail headers. If headers contain a Subject: line, the subject is set from that.
      *
@@ -100,7 +86,7 @@ class MailOutput extends GenericOutput
         // TODO: Check if any recipients in the first place
         $this->transport->setRecipients($recipients);
         $this->transport->setSubject($this->subject);
-        $this->transport->setHeaders($this->getHeaders());
+        $this->transport->setHeaders($this->headers);
         $this->transport->setContent($mailbody);
         return $this->transport->send();
     }
diff --git a/lib/Frs/Output/Transport/MailTransport.php b/lib/Frs/Output/Transport/MailTransport.php
index a177d98..794a1c1 100644
--- a/lib/Frs/Output/Transport/MailTransport.php
+++ b/lib/Frs/Output/Transport/MailTransport.php
@@ -26,7 +26,10 @@ class MailTransport implements TransportInterface
 
     public function setHeaders($headers)
     {
-        $this->headers = $headers;
+        $this->headers = '';
+        foreach ($headers as $key=>$value) {
+            $this->headers .= $key . ': ' . $value . "\r\n";
+        }
     }
 
     public function transmit()