ZF-11022: Setting resources.mail.transport.register = true causes an extra email to be sent to a bogus address.

Description

When using Zend_Mail_Transport_Sendmail via Zend_Application_Resouce_Mail and setting resources.mail.transport.register = true, I noticed a superfluous email being sent to a non-existent address in my mail logs:

Jan 30 04:30:14 myserver postfix/local[15519]: A97C84F52B: to=<1@mydomain.com>, orig_to=<1>, relay=local, 
delay=0.08, delays=0.03/0.02/0/0.03, dsn=5.1.1, status=bounced (unknown user: "1")
Jan 30 04:30:14 myserver postfix/local[15523]: B4DF24F547: to=<1@mydomain.com>, orig_to=<1>, relay=local, 
delay=0.02, delays=0/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user: "1")

The problem is that the 'register' value gets passed into Zend_Mail_Transport_Sendmail->__construct() as part of the $parameters array. For some reason, this causes an additional mail to be sent to 1@mydomain.com. This can be very costly when sending large amounts of email -- Postfix is having to work double for every email sent.

Another side-effect of this bug is that it breaks the fix added by ZF-9011, so you are unable to pass in an actual $parameters option to change sender envelope. Doing so results in the sending of yet another email to a bad address that looks like it comes from the specified envelope value, eg: -tcustomenvelope@mydomain.com. So in this case, ZF is attempting to send three emails when it should only send one!

I have a patch to fix this and will attach, but I'm not sure if this is the best way to fix it.

For reference, here is my application.ini

resources.mail.transport.type       = Zend_Mail_Transport_Sendmail
resources.mail.transport.register   = true
resources.mail.defaultFrom.email    = from@mydomain.com
resources.mail.defaultFrom.name     = "My Name"
resources.mail.defaultReplyTo.email = from@mydomain.com
resources.mail.defaultReplyTo.name  = "My Name"
resources.mail.transport.envelope   = "-f from@mydomain.com"

Comments

Can't for the life of me find out how to upload a patch as an attachment, so here it is:

Index: Zend/Application/Resource/Mail.php
===================================================================
--- Zend/Application/Resource/Mail.php  (revision 23688)
+++ Zend/Application/Resource/Mail.php  (working copy)
@@ -124,6 +124,7 @@
         }
 
         unset($options['type']);
+        unset($options['register']);
 
         switch($transportName) {
             case 'Zend_Mail_Transport_Smtp':

To send a patch, you must sign the CLA before.

patch attached

Whoops, ignore that last attachment, I accidentally uploaded the wrong one. This is the proper patch.

How can I get my patch reviewed for inclusion? I have to manually patch each point revision that comes out in order to fix this bug for my app.

Fix committed in r24109. Merged with branch 1.11 in r24110.

Thanks for making ZF better.