- Fixed #ZETACOMP-76: MailTools::replyTo will always use REPLY_ALL instead of
  distinguishing between REPLY_ALL and REPLY_SENDER.


git-svn-id: https://svn.apache.org/repos/asf/incubator/zetacomponents/trunk@1093993 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/Mail/ChangeLog b/Mail/ChangeLog
index 00f5a0e..81fe0c3 100644
--- a/Mail/ChangeLog
+++ b/Mail/ChangeLog
@@ -10,6 +10,8 @@
   errors in destructor.
 - Fixed #ZETACOMP-75: Mail parser doesn't understand uppercase "CHARSET" that
   alpine uses.
+- Fixed #ZETACOMP-76: MailTools::replyTo will always use REPLY_ALL instead of
+  distinguishing between REPLY_ALL and REPLY_SENDER.
 
 
 1.7 - Monday 21 December 2009
diff --git a/Mail/src/tools.php b/Mail/src/tools.php
index aee7fa5..e99fddd 100644
--- a/Mail/src/tools.php
+++ b/Mail/src/tools.php
@@ -42,7 +42,7 @@
     /**
      * Reply to all.
      */
-    const REPLY_ALL = 1;
+    const REPLY_ALL = 2;
 
     /**
      * Server to use for validateEmailAddressMx(). Change this if this server
diff --git a/Mail/tests/tools_test.php b/Mail/tests/tools_test.php
index 94b70a3..8721751 100644
--- a/Mail/tests/tools_test.php
+++ b/Mail/tests/tools_test.php
@@ -387,6 +387,27 @@
         );
     }
 
+	// test for ZETACOMP-76
+    public function testReplyToSelf()
+    {
+        $parser = new ezcMailParser();
+        $set = new ezcMailFileSet( array( dirname( __FILE__ )
+                                          . '/parser/data/various/multiple_recipients' ) );
+        $mail = $parser->parseMail( $set );
+
+        $reply = ezcMailTools::replyToMail( $mail[0],
+                                            new ezcMailAddress( 'test@example.com', 'Reply Guy' ),
+                                            ezcMailTools::REPLY_SENDER, 'Antwoord: ' );
+
+        $this->assertEquals( array( new ezcMailAddress( 'fh@ez.no', 'Frederik Holljen', 'utf-8' ) ),
+                             $reply->to );
+        $this->assertEquals( new ezcMailAddress( 'test@example.com', 'Reply Guy' ), $reply->from );
+        $this->assertEquals( array(), $reply->cc );
+        $this->assertEquals( 'Antwoord: Simple mail with text subject and body', $reply->subject );
+        $this->assertEquals( '<200602061533.27600.fh@ez.no>', $reply->getHeader( 'In-Reply-To' ) );
+        $this->assertEquals( '<1234.567@example.com> <200602061533.27600.fh@ez.no>', $reply->getHeader( 'References' ) );
+    }
+
     public function testReplyToAll()
     {
         $parser = new ezcMailParser();