Zend Framework

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

Details

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"

Issue Links

Activity

Hide
jsnod added a comment -

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':

Show
jsnod added a comment - 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':

Hide
Benoît Durand added a comment -

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

Show
Benoît Durand added a comment - To send a patch, you must sign the CLA before.
Hide
jsnod added a comment -

patch attached

Show
jsnod added a comment - patch attached
Hide
jsnod added a comment -

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

Show
jsnod added a comment - Whoops, ignore that last attachment, I accidentally uploaded the wrong one. This is the proper patch.
Hide
jsnod added a comment -

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.

Show
jsnod added a comment - 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.
Hide
Dolf Schimmel (Freeaqingme) added a comment - - edited

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

Thanks for making ZF better.

Show
Dolf Schimmel (Freeaqingme) added a comment - - edited Fix committed in r24109. Merged with branch 1.11 in r24110. Thanks for making ZF better.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: