TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Core\Utility\MailUtility Class Reference

Static Public Member Functions

static getSystemFrom ()
 
static getSystemFromName ()
 
static getSystemFromAddress ()
 
static breakLinesForEmail ($str, $newlineChar=LF, $lineWidth=76)
 

Detailed Description

Class to handle mail specific functionality

Definition at line 20 of file MailUtility.php.

Member Function Documentation

◆ breakLinesForEmail()

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

Breaks up a single line of text for emails Words - longer than $lineWidth - will not be split into parts

Parameters
string$strThe string to break up
string$newlineCharThe string to implode the broken lines with (default/typically
)
int$lineWidthThe line width
Returns
string Reformated text

Definition at line 110 of file MailUtility.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\MailUtilityTest\breakLinesForEmailBreaksTextIfCharWithIsExceeded(), TYPO3\CMS\Core\Tests\Unit\Utility\MailUtilityTest\breakLinesForEmailBreaksTextIfLineIsLongerThanTheLineWidth(), TYPO3\CMS\Core\Tests\Unit\Utility\MailUtilityTest\breakLinesForEmailBreaksTextWithNoSpaceFoundBeforeLimit(), and TYPO3\CMS\Core\Tests\Unit\Utility\MailUtilityTest\breakLinesForEmailReturnsOneLineIfCharWithIsNotExceeded().

◆ 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 29 of file MailUtility.php.

Referenced by TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\calcAge(), 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 71 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 49 of file MailUtility.php.

References $GLOBALS.

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