Browse Source

ZF-8436 Adding Zend_App_Resource_Mail, added some defaults stuff to Zend_Mail

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20039 44c647ce-9c0f-0410-b52a-842ac1e357ba
freak 16 years ago
parent
commit
a0867575fa

+ 40 - 0
documentation/manual/en/module_specs/Zend_Application-AvailableResources-Mail.xml

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<sect2 id="zend.application.available-resources.log">
+    <title>Zend_Application_Resource_Mail</title>
+
+    <para>
+        <classname>Zend_Application_Resource_Mail</classname> can be used
+        to instantiate a transport for <classname>Zend_Mail</classname> or set
+        the default name and address, as well as the default replyto- name and address.
+    </para>
+    
+    <para>When instantiating a transport, it's registered automatically to
+        <classname>Zend_Mail</classname>. Though, by setting the transport.register
+        directive to false, this behaviour does no more occur.
+    </para>
+    
+    <example id="zend.application.available-resources.mail.configExample">
+        <title>Sample Mail Resource Configuration</title>
+
+        <para>
+            Below is a sample <acronym>INI</acronym> snippet showing how to
+            configure the mail resource plugin.
+        </para>
+
+        <programlisting language="ini"><![CDATA[
+resources.mail.transport.type = smtp
+resources.mail.transport.host = "smtp.example.com"
+resources.mail.transport.auth = login
+resources.mail.transport.username = myUsername
+resources.mail.transport.password = myPassword
+resources.mail.transport.register = true ; True by default
+
+resources.mail.defaultFrom.email = john@example.com
+resources.mail.defaultFrom.name = "John Doe"
+resources.mail.defaultReplyTo.email = Jane@example.com
+resources.mail.defaultReplyTo.name = "Jane Doe"        
+]]></programlisting>
+
+    </example>
+</sect2>

+ 1 - 0
documentation/manual/en/module_specs/Zend_Application-AvailableResources.xml

@@ -13,6 +13,7 @@
     <xi:include href="Zend_Application-AvailableResources-Frontcontroller.xml" />
     <xi:include href="Zend_Application-AvailableResources-Layout.xml" />
     <xi:include href="Zend_Application-AvailableResources-Log.xml" />
+    <xi:include href="Zend_Application-AvailableResources-Mail.xml" />
     <xi:include href="Zend_Application-AvailableResources-Modules.xml" />
     <xi:include href="Zend_Application-AvailableResources-Navigation.xml" />
     <xi:include href="Zend_Application-AvailableResources-Router.xml" />

+ 23 - 4
documentation/manual/en/module_specs/Zend_Mail-MultipleEmails.xml

@@ -10,6 +10,17 @@
         delivery to ensure the correct SMTP handshake is followed.
     </para>
 
+    <para>
+        Optionally, you can also define a default From email address and name,
+        as well as a default reply-to header. This can be done through the static
+        methods <methodname>setDefaultFrom()</methodname> and
+        <methodname>setDefaultReplyTo()</methodname>. These defaults will be used when you
+        don't specify a From/Reply-to Address or -Name until the defaults are reset (cleared).
+        Resetting the defaults can be done through the use of the
+        <methodname>clearDefaultFrom()</methodname> and
+        <methodname>clearDefaultReplyTo</methodname>.
+    </para>
+
     <example id="zend.mail.multiple-emails.example-1">
 
         <title>Sending Multiple Mails per SMTP Connection</title>
@@ -19,17 +30,25 @@
 $config = array('name' => 'sender.example.com');
 $transport = new Zend_Mail_Transport_Smtp('mail.example.com', $config);
 
+// Set From & Reply-To address and name for all emails to send.
+Zend_Mail::setDefaultFrom('sender@example.com', 'John Doe');
+Zend_Mail::setDefaultReplyTo('replyto@example.com','Jane Doe');
+
 // Loop through messages
 for ($i = 0; $i < 5; $i++) {
     $mail = new Zend_Mail();
-    $mail->addTo('studio@peptolab.com', 'Test');
-    $mail->setFrom('studio@peptolab.com', 'Test');
+    $mail->addTo('studio@example.com', 'Test');
+
     $mail->setSubject(
         'Demonstration - Sending Multiple Mails per SMTP Connection'
     );
     $mail->setBodyText('...Your message here...');
     $mail->send($transport);
 }
+
+// Reset defaults
+Zend_Mail::clearDefaultFrom();
+Zend_Mail::clearDefaultReplyTo();
 ]]></programlisting>
 
     </example>
@@ -59,8 +78,8 @@ $transport->setConnection($protocol);
 // Loop through messages
 for ($i = 0; $i < 5; $i++) {
     $mail = new Zend_Mail();
-    $mail->addTo('studio@peptolab.com', 'Test');
-    $mail->setFrom('studio@peptolab.com', 'Test');
+    $mail->addTo('studio@example.com', 'Test');
+    $mail->setFrom('studio@example.com', 'Test');
     $mail->setSubject(
         'Demonstration - Sending Multiple Mails per SMTP Connection'
     );

+ 132 - 0
library/Zend/Application/Resource/Mail.php

@@ -0,0 +1,132 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Application
+ * @subpackage Resource
+ * @copyright  Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Db.php 17687 2009-08-20 12:55:34Z thomas $
+ */
+
+/**
+ * @see Zend_Application_Resource_ResourceAbstract
+ */
+require_once 'Zend/Application/Resource/ResourceAbstract.php';
+
+/**
+ * Resource for setting up Mail Transport and default From & ReplyTo addresses
+ *
+ * @uses       Zend_Application_Resource_ResourceAbstract
+ * @category   Zend
+ * @package    Zend_Application
+ * @subpackage Resource
+ * @copyright  Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Application_Resource_Mail extends Zend_Application_Resource_ResourceAbstract
+{
+
+    /**
+     * @var Zend_Mail_Transport_Abstract
+     */
+    protected $_transport;
+
+    public function init() {
+        return $this->getMail();
+    }
+    
+    /**
+     *
+     * @return Zend_Mail_Transport_Abstract|null
+     */
+    public function getMail()
+    {
+        if (null === $this->_transport) {
+            $options = $this->getOptions();
+            
+            if(isset($options['transport']) &&
+               !is_numeric($options['transport']))
+            {
+                $this->_transport = $this->_setupTransport($options['transport']);
+                if(!isset($options['transport']['register']) ||
+                   (isset($options['transport']['register']) &&
+                        !is_numeric($options['transport']['register']) &&
+                        (bool) $options['transport']['register'] == true))
+                {
+                    Zend_Mail::setDefaultTransport($this->_transport);
+                }
+            }
+            
+            $this->_setDefaults('from');
+            $this->_setDefaults('replyTo');
+        }
+
+        return $this->_transport;
+    }
+    
+    protected function _setDefaults($type) {
+        $key = strtolower('default' . $type);
+        $options = $this->getOptions();
+
+        if(isset($options[$key]['email']) &&
+           !is_numeric($options[$key]['email']))
+        {
+            $method = array('Zend_Mail', 'setDefault' . ucfirst($type));
+            if(isset($options[$key]['name']) &&
+               !is_numeric($options[$key]['name']))
+            {
+                call_user_func($method, $options[$key]['email'],
+                                        $options[$key]['name']);
+            } else {
+                call_user_func($method, $options[$key]['email']);
+            }
+        }
+    }
+
+    protected function _setupTransport($options)
+    {
+        $transportName = ucfirst(strtolower($options['type']));
+        unset($options['type']);
+
+        if(!Zend_Loader_Autoloader::autoload($transportName)) {
+            $transportName = 'Zend_Mail_Transport_' . $transportName;
+
+            if(!Zend_Loader_Autoloader::autoload($transportName)) {
+                throw new Zend_Application_Resource_Exception(
+                    "Specified Mail Transport '{$transportName}'"
+                    . 'could not be found'
+                );
+            }
+        }
+        
+        switch($transportName) {
+            case 'Zend_Mail_Transport_Smtp':
+                if(!isset($options['host'])) {
+                    throw new Zend_Application_Resource_Exception(
+                        'A host is necessary for smtp transport,'
+                        .' but none was given');
+                }
+                
+                $transport = new $transportName($options['host'], $options);
+                break;
+            case 'Zend_Mail_Transport_Sendmail':
+            default:
+                $transport = new $transportName($options);
+                break;
+        }
+
+        return $transport;
+    }
+}

+ 140 - 0
library/Zend/Mail.php

@@ -62,6 +62,18 @@ class Zend_Mail extends Zend_Mime_Message
     protected static $_defaultTransport = null;
 
     /**
+     * @var array
+     * @static
+     */    
+    protected static $_defaultFrom;
+
+    /**
+     * @var array
+     * @static
+     */ 
+    protected static $_defaultReplyTo;
+    
+    /**
      * Mail character set
      * @var string
      */
@@ -172,6 +184,26 @@ class Zend_Mail extends Zend_Mime_Message
     {
         self::$_defaultTransport = $transport;
     }
+    
+    /**
+     * Gets the default mail transport for all following uses of
+     * unittests
+     *
+     * @todo Allow passing a string to indicate the transport to load
+     * @todo Allow passing in optional options for the transport to load
+     */
+    public static function getDefaultTransport()
+    {
+        return self::$_defaultTransport;
+    }
+    
+    /**
+     * Clear the default transport property
+     */
+    public static function clearDefaultTransport()
+    {
+        self::$_defaultTransport = null;
+    }
 
     /**
      * Public constructor
@@ -713,6 +745,106 @@ class Zend_Mail extends Zend_Mime_Message
     }
 
     /**
+     * Sets Default From-email and name of the message
+     *
+     * @param  string               $email
+     * @param  string    Optional   $name
+     * @return void
+     */
+    public static function setDefaultFrom($email, $name = null)
+    {
+        self::$_defaultFrom = array('email' => $email, 'name' => $name);
+    }
+
+    /**
+     * Returns the default sender of the mail
+     * 
+     * @return null|array   Null if none was set.
+     */
+    public static function getDefaultFrom()
+    {
+        return self::$_defaultFrom;
+    }
+
+    /**
+     * Clears the default sender from the mail
+     * 
+     * @return void
+     */
+    public static function clearDefaultFrom()
+    {
+        self::$_defaultFrom = null;
+    }
+    
+    /**
+     * Sets From-name and -email based on the defaults
+     * 
+     * @return Zend_Mail Provides fluent interface
+     */
+    public function setFromToDefaultFrom() {
+        $from = self::getDefaultFrom();
+        if($from === null) {
+            require_once 'Zend/Mail/Exception.php';
+            throw new Zend_Mail_Exception(
+                'No default From Address set to use');
+        }
+        
+        $this->setFrom($from['email'], $from['name']);
+
+        return $this;
+    }
+    
+    /**
+     * Sets Default ReplyTo-address and -name of the message
+     *
+     * @param  string               $email
+     * @param  string    Optional   $name
+     * @return void
+     */
+    public static function setDefaultReplyTo($email, $name = null)
+    {
+        self::$_defaultReplyTo = array('email' => $email, 'name' => $name);
+    }
+    
+    /**
+     * Returns the default Reply-To Address and Name of the mail
+     * 
+     * @return null|array   Null if none was set.
+     */
+    public static function getDefaultReplyTo()
+    {
+        return self::$_defaultReplyTo;
+    }
+    
+    /**
+     * Clears the default ReplyTo-address and -name from the mail
+     * 
+     * @return void
+     */
+    public static function clearDefaultReplyTo()
+    {
+        self::$_defaultReplyTo = null;
+    }
+
+    /**
+     * Sets ReplyTo-name and -email based on the defaults
+     * 
+     * @return Zend_Mail Provides fluent interface
+     */
+    public function setReplyToFromDefault() {
+        $replyTo = self::getDefaultReplyTo();
+        if($replyTo === null) {
+            require_once 'Zend/Mail/Exception.php';
+            throw new Zend_Mail_Exception(
+                'No default Reply-To Address set to use');
+        }
+        
+        $this->setReplyTo($replyTo['email'], $replyTo['name']);
+
+        return $this;
+    }
+
+    /**
      * Sets the Return-Path header of the message
      *
      * @param  string    $email
@@ -1035,6 +1167,14 @@ class Zend_Mail extends Zend_Mime_Message
             $this->setDate();
         }
 
+        if(null === $this->_from && null !== self::getDefaultFrom()) {
+            $this->setFromToDefaultFrom();
+        }
+
+        if(null === $this->_replyTo && null !== self::getDefaultReplyTo()) {
+            $this->setReplyToFromDefault();
+        }
+
         $transport->send($this);
 
         return $this;

+ 4 - 0
library/Zend/Mail/Transport/Smtp.php

@@ -111,6 +111,9 @@ class Zend_Mail_Transport_Smtp extends Zend_Mail_Transport_Abstract
      * @param  string $host OPTIONAL (Default: 127.0.0.1)
      * @param  array|null $config OPTIONAL (Default: null)
      * @return void
+     * 
+     * @todo Someone please make this compatible
+     *       with the SendMail transport class.
      */
     public function __construct($host = '127.0.0.1', Array $config = array())
     {
@@ -177,6 +180,7 @@ class Zend_Mail_Transport_Smtp extends Zend_Mail_Transport_Abstract
      * developer to add a custom adapter if required before mail is sent.
      *
      * @return void
+     * @todo Rename this to sendMail, it's a public method...
      */
     public function _sendMail()
     {

+ 2 - 0
tests/Zend/Application/Resource/AllTests.php

@@ -34,6 +34,7 @@ require_once 'Zend/Application/Resource/FrontcontrollerTest.php';
 require_once 'Zend/Application/Resource/LayoutTest.php';
 require_once 'Zend/Application/Resource/LocaleTest.php';
 require_once 'Zend/Application/Resource/LogTest.php';
+require_once 'Zend/Application/Resource/MailTest.php';
 require_once 'Zend/Application/Resource/ModulesTest.php';
 require_once 'Zend/Application/Resource/NavigationTest.php';
 require_once 'Zend/Application/Resource/SessionTest.php';
@@ -67,6 +68,7 @@ class Zend_Application_Resource_AllTests
         $suite->addTestSuite('Zend_Application_Resource_LayoutTest');
         $suite->addTestSuite('Zend_Application_Resource_LocaleTest');
         $suite->addTestSuite('Zend_Application_Resource_LogTest');
+        $suite->addTestSuite('Zend_Application_Resource_MailTest');
         $suite->addTestSuite('Zend_Application_Resource_ModulesTest');
         $suite->addTestSuite('Zend_Application_Resource_NavigationTest');
         $suite->addTestSuite('Zend_Application_Resource_SessionTest');

+ 161 - 0
tests/Zend/Application/Resource/MailTest.php

@@ -0,0 +1,161 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Application
+ * @subpackage UnitTests
+ * @copyright  Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Application_Resource_MailTest::main');
+}
+
+/**
+ * Test helper
+ */
+require_once dirname(__FILE__) . '/../../../TestHelper.php';
+
+/**
+ * Zend_Loader_Autoloader
+ */
+require_once 'Zend/Loader/Autoloader.php';
+
+/**
+ * @see Zend_Application_Resource_Mail
+ */
+require_once 'Zend/Application/Resource/Mail.php';
+
+
+/**
+ * @category   Zend
+ * @package    Zend_Application
+ * @subpackage UnitTests
+ * @copyright  Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @group      Zend_Application
+ */
+class Zend_Application_Resource_MailTest extends PHPUnit_Framework_TestCase
+{
+    public static function main()
+    {
+        $suite  = new PHPUnit_Framework_TestSuite(__CLASS__);
+        $result = PHPUnit_TextUI_TestRunner::run($suite);
+    }
+
+    public function setUp()
+    {
+        // Store original autoloaders
+        $this->loaders = spl_autoload_functions();
+        if (!is_array($this->loaders)) {
+            // spl_autoload_functions does not return empty array when no
+            // autoloaders registered...
+            $this->loaders = array();
+        }
+
+        Zend_Loader_Autoloader::resetInstance();
+        $this->autoloader = Zend_Loader_Autoloader::getInstance();
+        $this->application = new Zend_Application('testing');
+        $this->bootstrap = new Zend_Application_Bootstrap_Bootstrap($this->application);
+
+        Zend_Controller_Front::getInstance()->resetInstance();
+    }
+
+    public function tearDown()
+    {
+        Zend_Mail::clearDefaultTransport();
+        
+        // Restore original autoloaders
+        $loaders = spl_autoload_functions();
+        foreach ($loaders as $loader) {
+            spl_autoload_unregister($loader);
+        }
+
+        foreach ($this->loaders as $loader) {
+            spl_autoload_register($loader);
+        }
+
+        // Reset autoloader instance so it doesn't affect other tests
+        Zend_Loader_Autoloader::resetInstance();
+    }
+
+    public function testInitializationInitializesMailObject()
+    {
+        $resource = new Zend_Application_Resource_Mail(array());
+        $resource->setBootstrap($this->bootstrap);
+        $resource->setOptions(array('transport' => array('type' => 'sendmail')));
+        $resource->init();
+        $this->assertTrue($resource->getMail() instanceof Zend_Mail_Transport_Abstract);
+        $this->assertTrue($resource->getMail() instanceof Zend_Mail_Transport_Sendmail);
+    }
+
+    public function testInitializationReturnsMailObject()
+    {
+        $resource = new Zend_Application_Resource_Mail(array());
+        $resource->setBootstrap($this->bootstrap);
+        $resource->setOptions(array('transport' => array('type' => 'sendmail')));
+        $resource->init();
+        $this->assertTrue($resource->init() instanceof Zend_Mail_Transport_Abstract);
+        $this->assertTrue(Zend_Mail::getDefaultTransport() instanceof Zend_Mail_Transport_Sendmail);
+    }
+
+    public function testOptionsPassedToResourceAreUsedToInitializeMailTransportSmtp()
+    {
+        // If host option isn't passed on, an exception is thrown, making this text effective
+        $options = array('transport' => array('type' => 'smtp',
+                                              'host' => 'example.com',
+                                              'register' => true));
+        $resource = new Zend_Application_Resource_Mail(array());
+        $resource->setBootstrap($this->bootstrap);
+        $resource->setOptions($options);
+
+        $resource->init();
+        $this->assertTrue(Zend_Mail::getDefaultTransport() instanceof Zend_Mail_Transport_Smtp);
+    }
+
+    public function testNotRegisteringTransport()
+    {
+        // If host option isn't passed on, an exception is thrown, making this test effective
+        $options = array('transport' => array('type' => 'sendmail',
+                                              'register' => false));
+        $resource = new Zend_Application_Resource_Mail(array());
+        $resource->setBootstrap($this->bootstrap);
+        $resource->setOptions($options);
+
+        $resource->init();
+        $this->assertNull(Zend_Mail::getDefaultTransport()); 
+    }
+    
+    public function testDefaultFromAndReplyTo()
+    {
+        $options = array('defaultfrom'    => array('email' => 'foo@example.com',
+                                                   'name' => 'Foo Bar'),
+                         'defaultreplyto' => array('email' => 'john@example.com',
+                                                   'name' => 'John Doe'));
+        $resource = new Zend_Application_Resource_Mail(array());
+        $resource->setBootstrap($this->bootstrap);
+        $resource->setOptions($options);
+
+        $resource->init();
+        $this->assertNull(Zend_Mail::getDefaultTransport());
+        $this->assertEquals($options['defaultfrom'], Zend_Mail::getDefaultFrom());
+        $this->assertEquals($options['defaultreplyto'], Zend_Mail::getDefaultReplyTo());
+    }
+}
+
+if (PHPUnit_MAIN_METHOD == 'Zend_Application_Resource_LogTest::main') {
+    Zend_Application_Resource_LogTest::main();
+}

+ 61 - 0
tests/Zend/Mail/MailTest.php

@@ -121,6 +121,11 @@ class Zend_Mail_Transport_Sendmail_Mock extends Zend_Mail_Transport_Sendmail
 class Zend_Mail_MailTest extends PHPUnit_Framework_TestCase
 {
 
+    public function tearDown() {
+        Zend_Mail::clearDefaultFrom();
+        Zend_Mail::clearDefaultReplyTo();
+    }
+    
     /**
      * Test case for a simple email text message with
      * multiple recipients.
@@ -838,6 +843,61 @@ class Zend_Mail_MailTest extends PHPUnit_Framework_TestCase
         $mail->setReplyTo('user2@example.com');
     }
 
+    public function testDefaultFrom() {
+        Zend_Mail::setDefaultFrom('john@example.com','John Doe');
+        $this->assertEquals(array('email' => 'john@example.com','name' =>'John Doe'), Zend_Mail::getDefaultFrom());
+
+        Zend_Mail::clearDefaultFrom();
+        $this->assertEquals(null, Zend_Mail::getDefaultFrom());
+        
+        Zend_Mail::setDefaultFrom('john@example.com');
+        $this->assertEquals(array('email' => 'john@example.com','name' => null), Zend_Mail::getDefaultFrom());
+    }
+
+    public function testDefaultReplyTo() {
+        Zend_Mail::setDefaultReplyTo('john@example.com','John Doe');
+        $this->assertEquals(array('email' => 'john@example.com','name' =>'John Doe'), Zend_Mail::getDefaultReplyTo());
+
+        Zend_Mail::clearDefaultReplyTo();
+        $this->assertEquals(null, Zend_Mail::getDefaultReplyTo());
+        
+        Zend_Mail::setDefaultReplyTo('john@example.com');
+        $this->assertEquals(array('email' => 'john@example.com','name' => null), Zend_Mail::getDefaultReplyTo());
+    }
+
+    public function testSettingFromDefaults() {
+        Zend_Mail::setDefaultFrom('john@example.com', 'John Doe');
+        Zend_Mail::setDefaultReplyTo('foo@example.com','Foo Bar');
+
+        $mail = new Zend_Mail();
+        $headers = $mail->setFromToDefaultFrom() // test fluent interface
+                        ->setReplyToFromDefault()
+                        ->getHeaders();
+
+        $this->assertEquals('john@example.com', $mail->getFrom());
+        $this->assertEquals('foo@example.com', $mail->getReplyTo());
+        $this->assertEquals('John Doe <john@example.com>', $headers['From'][0]);
+        $this->assertEquals('Foo Bar <foo@example.com>', $headers['Reply-To'][0]);
+    }
+
+    public function testMethodSendUsesDefaults()
+    {
+        Zend_Mail::setDefaultFrom('john@example.com', 'John Doe');
+        Zend_Mail::setDefaultReplyTo('foo@example.com','Foo Bar');
+        
+        $mail = new Zend_Mail();
+        $mail->setBodyText('Defaults Test');
+
+        $mock = new Zend_Mail_Transport_Mock();
+        $mail->send($mock);
+        $headers = $mock->headers;
+        
+        $this->assertTrue($mock->called);
+        $this->assertEquals($mock->from, 'john@example.com');
+        $this->assertEquals($headers['From'][0], 'John Doe <john@example.com>');
+        $this->assertEquals($headers['Reply-To'][0], 'Foo Bar <foo@example.com>');
+    }
+
     public static function dataSubjects()
     {
         return array(
@@ -929,4 +989,5 @@ class Zend_Mail_MailTest extends PHPUnit_Framework_TestCase
             }
         }
     }
+
 }