diff -urN ../z-push-2.2.0-1934.orig/backend/imap/imap.php ./backend/imap/imap.php --- ../z-push-2.2.0-1934.orig/backend/imap/imap.php 2013-08-23 17:41:36.000000000 +0300 +++ ./backend/imap/imap.php 2016-05-07 19:08:17.211248290 +0300 @@ -188,6 +188,7 @@ $forward_h_ct = ""; $forward_h_cte = ""; $envelopefrom = ""; + $rpath = ""; $use_orgbody = false; @@ -244,6 +245,7 @@ else $v = $this->username . IMAP_DEFAULTFROM; $envelopefrom = "-f$v"; } + $rpath = $v; } // check if "Return-Path"-header is set @@ -253,7 +255,9 @@ if (IMAP_DEFAULTFROM == 'username') $v = $this->username; else if (IMAP_DEFAULTFROM == 'domain') $v = $this->domain; else $v = $this->username . IMAP_DEFAULTFROM; + $envelopefrom = "-f$v"; } + $rpath = $v; } // all other headers stay @@ -269,6 +273,7 @@ if ($headers) $headers .= "\n"; $headers .= 'From: '.$v; $envelopefrom = "-f$v"; + $rpath = $v; } // set "Return-Path" header if not set on the device @@ -465,9 +470,12 @@ /* END fmbiete's contribution r1528, ZP-320 */ ZLog::Write(LOGLEVEL_DEBUG, "BackendIMAP->SendMail(): body: $body"); + if (preg_match('/<(.*)>/', $rpath, $matches)) $rpath = $matches[1]; + if (!$envelopefrom) $envelopefrom = "-f".$rpath; if (!defined('IMAP_USE_IMAPMAIL') || IMAP_USE_IMAPMAIL == true) { // changed by mku ZP-330 - $send = @imap_mail ( $toaddr, $message->headers["subject"], $body, $headers, $ccaddr, $bccaddr); +// $send = @imap_mail ( $toaddr, $message->headers["subject"], $body, $headers, $ccaddr, $bccaddr); + $send = @imap_mail ( $toaddr, $message->headers["subject"], $body, $headers, $ccaddr, $bccaddr, $rpath); } else { if (!empty($ccaddr)) $headers .= "\nCc: $ccaddr"; diff -urN ../z-push-2.2.0-1934.orig/z-push-admin.php ./z-push-admin.php --- ../z-push-2.2.0-1934.orig/z-push-admin.php 2013-02-28 23:02:27.000000000 +0200 +++ ./z-push-admin.php 2016-05-07 19:08:17.191249100 +0300 @@ -1,4 +1,4 @@ -#!/usr/bin/php +#!/usr/local/bin/php