php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #30688
Patch patch2 revision 2011-08-22 13:18 UTC by ava3ar at gmail dot com
Patch Patch-by-Keloran-ava3ar-at-gmail-com revision 2011-08-04 16:18 UTC by pajoye@php.net

Patch Patch-by-Keloran-ava3ar-at-gmail-com for IMAP related Bug #30688

Patch version 2011-08-04 16:18 UTC

Return to Bug #30688 | Download this patch
Patch Revisions:

Developer: pajoye@php.net

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);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 28 15:01:29 2024 UTC