[ZendTo] Re: Return-Path change
Brad Beckenhauer
bbecken at aafp.org
Wed Sep 22 17:55:13 BST 2010
Jules,
All very true, I was only looking at this from the zendto vm position and documenting what I've found to date. I'll keep looking to see if I can figure out where the issue lies and hopefully just use the PHP code at hand. Like you, I don't want to have to modify the MTA settings either if it can be avoided.
thanks for your thoughts.
Brad
>>> On 9/22/2010 at 11:06 AM, in message <4C9A299F.5080108 at Zend.To>, Jules <Jules at zend.to> wrote:
The problem is that people might not have sendmail installed (or even a program which fakes it, like Postfix does). I would rather use the PHP function call as the PHP build on the machine will have been done correctly for that type of system, working around it is usually a bad idea.
Also, sendmail is often not present in /usr/lib (that's there for ancient historical reasons, not appreciated by all modern system builders).
So I'm reluctant to call sendmail directly, as that's avoiding all the (sensible) logic in the PHP configuration script when PHP is built on that system.
On true sendmail systems (and not necessarily on other mail systems that fake the sendmail binary), the Return-Path header will be set in the sendmail.cf file. The last thing I want is for people to have to edit their sendmail.cf file, they shouldn't have to do that for an app which is just trying to send mail and not process it.
Jules.
On 22/09/2010 16:06, Brad Beckenhauer wrote:
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> ( mailto:4C9943F1.2070900 at Zend.To ), Jules <Jules at zend.to> ( mailto: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
_______________________________________________
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/e72eec27/attachment-0001.html
More information about the ZendTo
mailing list