41 static public function mail($to, $subject, $messageBody, $additionalHeaders = NULL, $additionalParameters = NULL) {
45 if (!preg_match(
'/^From:/im', $additionalHeaders) &&
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromAddress']) {
46 if (!is_null($additionalHeaders) && substr($additionalHeaders, -1) != LF) {
47 $additionalHeaders .= LF;
49 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromName']) {
50 $additionalHeaders .=
'From: "' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromName'] .
'" <' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromAddress'] .
'>';
52 $additionalHeaders .=
'From: ' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromAddress'];
55 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/utility/class.t3lib_utility_mail.php'][
'substituteMailDelivery'])) {
58 'subject' => $subject,
59 'messageBody' => $messageBody,
60 'additionalHeaders' => $additionalHeaders,
61 'additionalParameters' => $additionalParameters
64 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/utility/class.t3lib_utility_mail.php'][
'substituteMailDelivery'] as $hookSubscriber) {
65 $hookSubscriberContainsArrow = strpos($hookSubscriber,
'->');
66 if ($hookSubscriberContainsArrow !== FALSE) {
67 throw new \RuntimeException($hookSubscriber .
' is an invalid hook implementation. Please consider using an implementation of TYPO3\\CMS\\Core\\Mail\\MailerAdapter.', 1322287600);
70 if ($mailerAdapter instanceof \
TYPO3\CMS\Core\
Mail\MailerAdapterInterface) {
71 $success = $success && $mailerAdapter->mail($to, $subject, $messageBody, $additionalHeaders, $additionalParameters, $fakeThis);
73 throw new \RuntimeException($hookSubscriber .
' is not an implementation of TYPO3\\CMS\\Core\\Mail\\MailerAdapter, 74 but must implement that interface to be used in the substituteMailDelivery hook.', 1294062286);
79 if (is_null($additionalParameters)) {
80 $success = @
mail($to, $subject, $messageBody, $additionalHeaders);
82 $success = @
mail($to, $subject, $messageBody, $additionalHeaders, $additionalParameters);
99 $address = self::getSystemFromAddress();
100 $name = self::getSystemFromName();
104 return array($address => $name);
106 return array($address);
118 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromName']) {
119 return $GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromName'];
140 $address =
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromAddress'];
144 $domainRecord =
$GLOBALS[
'TYPO3_DB']->exec_SELECTgetSingleRow(
'domainName',
'sys_domain',
'hidden = 0',
'',
'pid ASC, sorting ASC');
145 if (!empty($domainRecord[
'domainName'])) {
146 $tempUrl = $domainRecord[
'domainName'];
150 $tempUrl =
'http://' . $tempUrl;
152 $host = parse_url($tempUrl, PHP_URL_HOST);
154 $address =
'no-reply@' .
$host;
157 $address =
'no-reply@' . php_uname(
'n');
160 $address =
'no-reply@example.com';
179 while (strlen($str) > $substrStart) {
180 $substr = substr($str, $substrStart, $lineWidth);
182 if (strlen($substr) == $lineWidth) {
184 $spacePos = strrpos(rtrim($substr),
' ');
186 if ($spacePos !== FALSE) {
188 $theLine = substr($substr, 0, $spacePos);
193 $afterParts = explode(
' ', substr($str, $lineWidth + $substrStart), 2);
194 $theLine = $substr . $afterParts[0];
196 if (!strlen($theLine)) {
203 $lines[] = trim($theLine);
204 $substrStart += strlen($theLine);
205 if (trim(substr($str, $substrStart, $lineWidth)) ===
'') {
210 return implode($newlineChar, $lines);
225 static public function parseAddresses($rawAddresses) {
228 'TYPO3\\CMS\\Core\\Mail\\Rfc822AddressesParser',
231 $addresses = $addressParser->parseAddressList();
232 $addressList = array();
233 foreach ($addresses as $address) {
234 if ($address->mailbox ===
'') {
237 if ($address->personal) {
239 $addressList[$address->mailbox .
'@' . $address->host] = $address->personal;
242 $addressList[] = $address->mailbox .
'@' . $address->host;
static mail($to, $subject, $messageBody, $additionalHeaders=NULL, $additionalParameters=NULL)
static isFirstPartOfStr($str, $partStr)
static validEmail($email)
static logDeprecatedFunction()
static makeInstance($className)
static getSystemFromAddress()
const SYSLOG_SEVERITY_ERROR
static breakLinesForEmail($str, $newlineChar=LF, $lineWidth=76)
static getSystemFromName()
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]