Feature #22212 » sendMail.patch
t3lib/class.t3lib_div.php (working copy) | ||
---|---|---|
// 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 (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['substitudeMailDelivery'])) {
|
||
$hookMethod = $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 = t3lib_div::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;
|
||
}
|
t3lib/class.t3lib_htmlmail.php (working 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);
|
||
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);
|
||
... | ... | |
// 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);
|
||
... | ... | |
$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);
|