Index: t3lib/class.t3lib_beuserauth.php =================================================================== --- t3lib/class.t3lib_beuserauth.php (revision 7082) +++ t3lib/class.t3lib_beuserauth.php (working copy) @@ -345,7 +345,7 @@ $prefix='[AdminLoginWarning]'; } if ($warn) { - mail($GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr'], + t3lib_div::plainMail($GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr'], $prefix.' '.$subject, $msg, $this->notifyHeader @@ -355,7 +355,7 @@ // If An email should be sent to the current user, do that: if ($this->uc['emailMeAtLogin'] && strstr($this->user['email'],'@')) { - mail($this->user['email'], + t3lib_div::plainMail($this->user['email'], $subject, $msg, $this->notifyHeader Index: t3lib/class.t3lib_div.php =================================================================== --- t3lib/class.t3lib_div.php (revision 7082) +++ t3lib/class.t3lib_div.php (working copy) @@ -5129,9 +5129,42 @@ // So we stick to LF in all cases. $headers = trim(implode(chr(10), self::trimExplode(chr(10), $headers, true))); // Make sure no empty lines are there. - $ret = @mail($email, $subject, $message, $headers); + + return t3lib_div::plainMail($email, $subject, $message, $headers); + } + + /** + * Proxy for the PHP mail() function. Adds possibility to hook in and send the mails in a different way. + * + * @param string Email address to send to. (see PHP function mail()) + * @param string Subject line, non-encoded. (see PHP function mail()) + * @param string Message content, non-encoded. (see PHP function mail()) + * @param string Additional headers for the mail (see PHP function mail()) + * @param string Additional flags for the sending mail tool (see PHP function mail()) + */ + public static function plainMail($to, $subject, $message, $additional_headers = null, $additional_parameters = null) { + + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['substitudeMailDelivery'])) { + + $params = array( + 'to' => $to, + 'subject' => $subject, + 'message' => $message, + 'additional_headers' => $additional_headers, + 'additional_parameters' => $additional_parameters + ); + $fakeThis = FALSE; + $ret = true; + foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['substitudeMailDelivery'] as $hookMethod) { + $ret = $ret && self::callUserFunction($hookMethod,$params,$fakeThis); + } + + } else { + $ret = @mail($to, $subject, $message, $additional_headers, $additional_parameters); + } + if (!$ret) { - self::sysLog('Mail to "'.$email.'" could not be sent (Subject: "'.$subject.'").', 'Core', 3); + t3lib_div::sysLog('Mail to "' . $email . '" could not be sent (Subject: "' . $subject . '").', 'Core', 3); } return $ret; } @@ -5424,7 +5457,7 @@ // send message per mail elseif ($type == 'mail') { list($to,$from) = explode('/',$destination); - mail($to, 'Warning - error in TYPO3 installation', + t3lib_div::plainMail($to, 'Warning - error in TYPO3 installation', 'Host: '.$TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost']."\n". 'Extension: '.$extKey."\n". 'Severity: '.$severity."\n". Index: t3lib/class.t3lib_htmlmail.php =================================================================== --- t3lib/class.t3lib_htmlmail.php (revision 7082) +++ t3lib/class.t3lib_htmlmail.php (working copy) @@ -735,13 +735,13 @@ // 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); if ($returnPathPossible) { - $mailWasSent = mail($recipient, + $mailWasSent = t3lib_div::plainMail($recipient, $this->subject, $this->message, $this->headers, $returnPath); } else { - $mailWasSent = mail($recipient, + $mailWasSent = t3lib_div::plainMail($recipient, $this->subject, $this->message, $this->headers); @@ -750,13 +750,13 @@ // Sending a copy if ($recipient_copy) { if ($returnPathPossible) { - $mailWasSent = mail($recipient_copy, + $mailWasSent = t3lib_div::plainMail($recipient_copy, $this->subject, $this->message, $this->headers, $returnPath); } else { - $mailWasSent = mail($recipient_copy, + $mailWasSent = t3lib_div::plainMail($recipient_copy, $this->subject, $this->message, $this->headers); @@ -767,13 +767,13 @@ $theParts = explode('/',$this->auto_respond_msg,2); $theParts[1] = str_replace("/",chr(10),$theParts[1]); if ($returnPathPossible) { - $mailWasSent = mail($this->from_email, + $mailWasSent = t3lib_div::plainMail($this->from_email, $theParts[0], $theParts[1], 'From: ' . $recipient, $returnPath); } else { - $mailWasSent = mail($this->from_email, + $mailWasSent = t3lib_div::plainMail($this->from_email, $theParts[0], $theParts[1], 'From: ' . $recipient); Index: t3lib/class.t3lib_userauthgroup.php =================================================================== --- t3lib/class.t3lib_userauthgroup.php (revision 7082) +++ t3lib/class.t3lib_userauthgroup.php (working copy) @@ -1810,7 +1810,7 @@ $email_body.= date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'].' '.$GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'],$testRows['tstamp']).': '.@sprintf($testRows['details'],''.$theData[0],''.$theData[1],''.$theData[2]); $email_body.= chr(10); } - mail( $email, + t3lib_div::plainMail($email, $subject, $email_body, 'From: TYPO3 Login WARNING<>' Index: typo3/sysext/install/mod/class.tx_install.php =================================================================== --- typo3/sysext/install/mod/class.tx_install.php (revision 7082) +++ typo3/sysext/install/mod/class.tx_install.php (working copy) @@ -367,7 +367,7 @@ if ($wEmail) { $subject="Install Tool Login at '".$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']."'"; $email_body="There has been a Install Tool login at TYPO3 site '".$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']."' (".t3lib_div::getIndpEnv('HTTP_HOST').") from remote address '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndpEnv('REMOTE_HOST').')'; - mail($wEmail, + t3lib_div::plainMail($wEmail, $subject, $email_body, 'From: TYPO3 Install Tool WARNING <>' @@ -383,7 +383,7 @@ $email_body="There has been an Install Tool login attempt at TYPO3 site '".$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']."' (".t3lib_div::getIndpEnv('HTTP_HOST')."). The MD5 hash of the last 5 characters of the password tried was '".substr(md5($p), -5)."' REMOTE_ADDR was '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndpEnv('REMOTE_HOST').')'; - mail($wEmail, + t3lib_div::plainMail($wEmail, $subject, $email_body, 'From: TYPO3 Install Tool WARNING <>'