Index: ext/imap/php_imap.c
===================================================================
--- ext/imap/php_imap.c (revision 314217)
+++ ext/imap/php_imap.c (working copy)
@@ -4016,7 +4016,27 @@
        if (!INI_STR("sendmail_path")) {
                return 0;
        }
-       sendmail = popen(INI_STR("sendmail_path"), "w");
+
+       /** Used to make return-path work **/
+        char *sendmail_path = INI_STR("sendmail_path");
+        char *appended_sendmail_path = NULL;
+
+        /** Return Path or not **/
+        if (rpath && rpath[0]) {
+            appended_sendmail_path = emalloc(
+                strlen(sendmail_path) + 3 + strlen(rpath) + 1);
+            strcpy(appended_sendmail_path, sendmail_path);
+            strcat(appended_sendmail_path, " -f");
+            strcat(appended_sendmail_path, rpath);
+            sendmail_path = appended_sendmail_path;
+        }
+
+        /** open the sendmail pointer **/
+        sendmail = popen(sendmail_path, "w"); /* New Code */
+
+       if (appended_sendmail_path)
+            efree(appended_sendmail_path);
+
        if (sendmail) {
                if (rpath && rpath[0]) fprintf(sendmail, "From: %s\n",
rpath);
                fprintf(sendmail, "To: %s\n", to);

================

hopefully that will work to fix the rpath option, and finally close this
bug http://bugs.php.net/bug.php?id=30688

Reply via email to