Body might be a stream, so convert to text in mock driver
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 10 Sep 2010 17:23:42 +0000 (11:23 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 10 Sep 2010 17:25:28 +0000 (11:25 -0600)
framework/Mail/lib/Horde/Mail/Transport/Mock.php

index 4b1de5d..e36d05a 100644 (file)
@@ -123,8 +123,15 @@ class Horde_Mail_Transport_Mock extends Horde_Mail_Transport
         $headers = $this->_sanitizeHeaders($headers);
         list(, $text_headers) = $this->prepareHeaders($headers);
 
+        if (is_resource($body)) {
+            rewind($body);
+            $body_txt = stream_get_contents($body);
+        } else {
+            $body_txt = $body;
+        }
+
         $this->sentMessages[] = array(
-            'body' => $body,
+            'body' => $body_txt,
             'headers' => $headers,
             'header_text' => $text_headers,
             'recipients' => $recipients