[ZendTo] Re: Return-Path change

Brad Beckenhauer bbecken at aafp.org
Wed Sep 22 16:06:34 BST 2010


Ok,
 
I'm not a PHP programmer, but I researched this issue and found this reported issue as a bug on the PHP Solaris forum back in 2004.
 
http://bugs.php.net/bug.php?id=29122
 
I also applied the code presented in the above bug trac and substituted the logic from the bug trac with the mail() logic and the Return-Path works (Diff below).
 
I uncompressed the Julian's php rpm package in the Zendto centos-64 vm and found that the bug was not present in that package, so the issue appears to be an interaction issue between sendmail and PHP.   Either sendmail is not accepting the Return-Path or PHP is not providing (or providing incorrectly) the Return-path to sendmail.
 
I also downloaded the current PHP 5.2 build and grep'd for the bad code noted in the bug trac that the bug was not present in that package.
 
Julian,
As usual, I'll defer to you on what you'd like to do as far as final code changes.   I'm just reporting my discoveries for you.
 
I used Zendto to send an package to a fictitious, non-existent email account and received a bounce back to my email account from my MTA with the original Zendto message attached.  Yea!!!
 
Below is the diff file for the changes I made that worked, you previously used a return statement and this does not and my cause issues.
 
Please let me know what changes you make to the code.
 
have a good day
Brad
 
 
--- NSSDropbox.php.original  2010-09-21 17:20:10.000000000 -0500
+++ NSSDropbox.php      2010-09-22 08:58:28.000000000 -0500
@@ -678,14 +678,14 @@
     $content
   )
   {
-    return mail(
-              $toAddr,
-              $subject,
-              $content,
-              ($fromAddr==""?"":sprintf("From: %s\r\nReply-to: %s\r\n",
-                                        $fromAddr, $fromAddr)
-              )
-            );
+       // running php rpm: php-5.1.6-27.jkf
+       // issue between PHP mail() function and sendmail where sendmail is not 
+       // accepting/receiving the 'Return-Path' from PHP.
+       // similar to bug: http://bugs.php.net/bug.php?id=29122
+       $tmp_msg_string = "To: $toAddr\nSubject:  $subject\n\n$content\n";
+       $tmp_handle = popen ("/usr/lib/sendmail -f$fromAddr $toAddr", "w");
+       fwrite ($tmp_handle, $tmp_msg_string);
+       $result = pclose ($tmp_handle);
   }
 
   /*!


>>> On 9/21/2010 at 6:46 PM, in message <4C9943F1.2070900 at Zend.To>, Jules <Jules at zend.to> wrote:

Try setting "Errors-To:" instead of "Return-Path:".

On 22/09/2010 00:03, Brad Beckenhauer wrote: 

Looks like sendmail is overriding php.
 
Drupal had a similiar issue.
see:
http://drupal.org/node/131737
 
brad

>>> On 9/21/2010 at 4:32 PM, in message <4C99246D.9000205 at Zend.To> ( mailto:4C99246D.9000205 at Zend.To ), Jules <Jules at zend.to> ( mailto:Jules at zend.to ) wrote:

In lib/NSSDropbox.php change

--- SNIP ---
  public function deliverEmail(
    $toAddr,
    $fromAddr,
    $subject,
    $content
  )
  {
    return mail(
              $toAddr,
              $subject,
              $content,
              ($fromAddr==""?"":sprintf("From: %s\r\nReply-to: %s\r\n",
                                        $fromAddr, $fromAddr)
              )
            );
  }
--- SNIP ---
to this:
--- SNIP ---
  public function deliverEmail(
    $toAddr,
    $fromAddr,
    $subject,
    $content
  )
  {
    return mail(
              $toAddr,
              $subject,
              $content,
              ($fromAddr==""?"":sprintf("From: %s\r\nReply-to: %s\r\nReturn-Path: %s\r\n",
                                        $fromAddr, $fromAddr, $fromAddr)
              )
            );
  }
--- SNIP ---

Please let me know if this solves the problem for you, and I will put it into the code.

Jules.

On 21/09/2010 21:48, Brad Beckenhauer wrote: 

I was looking at this same issue yesterday, but ran out of time.
 
a snip from the web on the Return-Path
 
Envelope information: Return-Path, Received
Return-Path
The value of a Return-Path field is tokenizable. It shows the return path of the message, i.e., the address that bounces will be sent to. It is either (1) a < token followed by a > token, indicating an empty return path, or (2) a bracketed address. Two examples:
 
     Return-Path: <>
     Return-Path: <God at heaven.af.mil>
 
Messages transmitted through SMTP generally do not have Return-Path fields; the return path is transmitted out-of-band in the SMTP MAIL request. When a message is stored in a mailbox, the return path is stored in a Return-Path field. If the message is then retrieved (e.g., through POP) and sent through another SMTP hop, the Return-Path is removed and the return path is again sent out-of-band. 
 
 
I'm pretty sure the function calling it is in the lib/NSSDropbox file, but have not figured out exactly how to add the coding.
 
I'll be watching this thread.
Brad
 
 


>>> On 9/21/2010 at 2:44 PM, in message <9453A32CAC9FFB4D8F59285E34B6A50604AD27 at hotc_exch.harperotc.com> ( mailto:9453A32CAC9FFB4D8F59285E34B6A50604AD27 at hotc_exch.harperotc.com ), "Naz Snidanko" <nsnidanko at harperpowerproducts.com> ( mailto:nsnidanko at harperpowerproducts.com ) wrote:


Hi, ZendTo Users
Scenario:
User creates dropoff but misspells email address. MTA tries to deliver but domain has no MX record, so it generates bounce-back email sent to Return-Path: header value, which goes nowhere (www-data at server.domain.com in my case) and thus it creates confusion 
How can I change Return-Path: header value for an email address of the person that created dropoff? To either From or Reply-To? Tis way person will get bounce back message and correct his mistake.
Please advice,

Naz Snidanko
Desktop & Network Support
Harper Power Products Inc.
(p) 416 201- 7506
nsnidanko at harperpowerproducts.com
_______________________________________________
ZendTo mailing listZendTo at zend.tohttp://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto
Jules

-- 
Julian Field MEng CITP CEngwww.Zend.To
Need help fixing or optimising your systems?
Contact me!
Need help getting you started solving new requirements from your boss?
Contact me!

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
Follow me at twitter.com/JulesFM
_______________________________________________
ZendTo mailing listZendTo at zend.tohttp://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto
Jules

-- 
Julian Field MEng CITP CEngwww.Zend.To
Need help fixing or optimising your systems?
Contact me!
Need help getting you started solving new requirements from your boss?
Contact me!

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
Follow me at twitter.com/JulesFM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/zendto/attachments/20100922/73b0de19/attachment.html 


More information about the ZendTo mailing list