TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Core\Utility\MailUtility Class Reference
Inheritance diagram for TYPO3\CMS\Core\Utility\MailUtility:
t3lib_utility_Mail

Static Public Member Functions

static mail ($to, $subject, $messageBody, $additionalHeaders=NULL, $additionalParameters=NULL)
 
static getSystemFrom ()
 
static getSystemFromName ()
 
static getSystemFromAddress ()
 
static breakLinesForEmail ($str, $newlineChar=LF, $lineWidth=76)
 

Detailed Description

Class to handle mail specific functionality

Author
Tolleiv Nietsch niets.nosp@m.ch@a.nosp@m.oemed.nosp@m.ia.d.nosp@m.e

Definition at line 24 of file MailUtility.php.

Member Function Documentation

◆ breakLinesForEmail()

static TYPO3\CMS\Core\Utility\MailUtility::breakLinesForEmail (   $str,
  $newlineChar = LF,
  $lineWidth = 76 
)
static

◆ getSystemFrom()

static TYPO3\CMS\Core\Utility\MailUtility::getSystemFrom ( )
static

Gets a valid "from" for mail messages (email and name).

Ready to be passed to $mail->setFrom()

Returns
array key=Valid email address which can be used as sender, value=Valid name which can be used as a sender. NULL if no address is configured

Definition at line 98 of file MailUtility.php.

Referenced by TYPO3\CMS\Core\Utility\GeneralUtility\initSysLog(), TYPO3\CMS\Core\Authentication\BackendUserAuthentication\resetUC(), TYPO3\CMS\Reports\Task\SystemStatusUpdateTask\setNotificationEmail(), and TYPO3\CMS\Core\Authentication\BackendUserAuthentication\simplelog().

◆ getSystemFromAddress()

static TYPO3\CMS\Core\Utility\MailUtility::getSystemFromAddress ( )
static

Creates a valid email address for the sender of mail messages.

Uses a fallback chain: $TYPO3_CONF_VARS['MAIL']['defaultMailFromAddress'] -> no-reply -> no-reply('n') -> no-re.nosp@m.ply@.nosp@m.examp.nosp@m.le.c.nosp@m.om

Ready to be passed to $mail->setFrom()

Returns
string An email address

Definition at line 138 of file MailUtility.php.

References $GLOBALS, $host, TYPO3\CMS\Core\Utility\GeneralUtility\isFirstPartOfStr(), and TYPO3\CMS\Core\Utility\GeneralUtility\validEmail().

Referenced by TYPO3\CMS\Linkvalidator\Task\ValidatorTask\getLinkTypes(), and TYPO3\CMS\Form\PostProcess\MailPostProcessor\setFrom().

◆ getSystemFromName()

static TYPO3\CMS\Core\Utility\MailUtility::getSystemFromName ( )
static

Creates a valid "from" name for mail messages.

As configured in Install Tool.

Returns
string The name (unquoted, unformatted). NULL if none is set

Definition at line 117 of file MailUtility.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Linkvalidator\Task\ValidatorTask\getLinkTypes().

◆ mail()

static TYPO3\CMS\Core\Utility\MailUtility::mail (   $to,
  $subject,
  $messageBody,
  $additionalHeaders = NULL,
  $additionalParameters = NULL 
)
static

Proxy for the PHP mail() function. Adds possibility to hook in and send the mails in a different way. The hook can be used by adding function to the configuration array: $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery']

Parameters
string$toEmail address to send to.
string$subjectSubject line, non-encoded. (see PHP function mail())
string$messageBodyMessage content, non-encoded. (see PHP function mail())
string$additionalHeadersAdditional headers for the mail (see PHP function mail())
string$additionalParametersAdditional flags for the sending mail tool (see PHP function mail())
Returns
boolean Indicates whether the mail has been sent or not
See also
PHP function mail() [] deprecated 88.

Definition at line 41 of file MailUtility.php.

References $GLOBALS, $parameters, TYPO3\CMS\Core\Utility\GeneralUtility\logDeprecatedFunction(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Core\Utility\GeneralUtility\SYSLOG_SEVERITY_ERROR.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\MailUtilityTest\doMailCallsHook().