diff -ru ./typo3.orig/trunk/t3lib/class.t3lib_htmlmail.php ./typo3.new/trunk/t3lib/class.t3lib_htmlmail.php --- ./typo3.orig/trunk/t3lib/class.t3lib_htmlmail.php 2010-03-01 12:09:02.986059652 +0100 +++ ./typo3.new/trunk/t3lib/class.t3lib_htmlmail.php 2010-03-01 13:58:51.286024540 +0100 @@ -723,17 +723,27 @@ return false; } - // On windows the -f flag is not used (specific for Sendmail and Postfix), + // On windows the -f flag is not used (specific for Sendmail), // but instead the php.ini parameter sendmail_from is used. - $returnPath = (strlen($this->returnPath) > 0) ? '-f ' . escapeshellarg($this->returnPath) : ''; - if($this->returnPath) { - @ini_set('sendmail_from', t3lib_div::normalizeMailAddress($this->returnPath)); + $returnPath = ($this->forceReturnPath && strlen($this->returnPath) > 0) ? '-f ' . escapeshellarg($this->returnPath) : ''; + $returnPathMayPossible = false; + if (TYPO3_OS == 'WIN') { + $returnPathMayPossible = true; + if ($this->returnPath) { + // This works only on Windows. On Unix this _might_ lead to 500 errors + @ini_set('sendmail_from', t3lib_div::normalizeMailAddress($this->returnPath)); + } } $recipient = t3lib_div::normalizeMailAddress($this->recipient); $recipient_copy = t3lib_div::normalizeMailAddress($this->recipient_copy); // If safe mode is on, the fifth parameter to mail is not allowed, so the fix wont work on unix with safe_mode=On - $returnPathPossible = (!ini_get('safe_mode') && $this->forceReturnPath); + // On unix, only a scrupulous well configured sendmail MTA accepts the -f parameter. The currently popular postfix MTA + // refuses this as well as other MTA like exim or qmail due to popular separaration of user privileges. + // Indeed, -f _can_ be configured for the cost of potential overall system vulnurability. + // To get a crossplatform functional framework, the PHP mail() function should be marked deprecated and a class should + // be introduced to perform SMTP like pear net_SMTP + $returnPathPossible = (!ini_get('safe_mode') && $this->forceReturnPath && $returnPathMayPossible); if ($returnPathPossible) { $mailWasSent = mail($recipient, $this->subject,