‪TYPO3CMS  10.4
TYPO3\CMS\Core\Utility\MailUtility Class Reference

Static Public Member Functions

static array getSystemFrom ()
 
static string getSystemFromName ()
 
static string getSystemFromAddress ()
 
static array getSystemReplyTo ()
 
static string breakLinesForEmail ($str, $newlineChar=LF, $lineWidth=76)
 
static array parseAddresses ($rawAddresses)
 

Detailed Description

Class to handle mail specific functionality

Definition at line 23 of file MailUtility.php.

Member Function Documentation

◆ breakLinesForEmail()

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

◆ getSystemFrom()

static array 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 32 of file MailUtility.php.

References TYPO3\CMS\Core\Utility\MailUtility\getSystemFromAddress(), and TYPO3\CMS\Core\Utility\MailUtility\getSystemFromName().

◆ getSystemFromAddress()

static string 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@FirstDomainRecordFound -> no-reply@php_uname('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 73 of file MailUtility.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Install\Authentication\AuthenticationService\getSenderEmailAddress(), TYPO3\CMS\Core\Utility\MailUtility\getSystemFrom(), TYPO3\CMS\Linkvalidator\Task\ValidatorTask\reportEmail(), and TYPO3\CMS\Core\Mail\Mailer\send().

◆ getSystemFromName()

static string 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 52 of file MailUtility.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Install\Authentication\AuthenticationService\getSenderEmailName(), TYPO3\CMS\Core\Utility\MailUtility\getSystemFrom(), TYPO3\CMS\Linkvalidator\Task\ValidatorTask\reportEmail(), and TYPO3\CMS\Core\Mail\Mailer\send().

◆ getSystemReplyTo()

static array TYPO3\CMS\Core\Utility\MailUtility::getSystemReplyTo ( )
static

Gets a default "reply-to" for mail messages (email and name).

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

Returns
‪array List of email-addresses. Specifying a realname can be done in the form of "replyToName <replyTo@example.com>".

Definition at line 95 of file MailUtility.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\MailUtilityTest\getSystemReplyToTest(), and TYPO3\CMS\Core\Mail\Mailer\send().

◆ parseAddresses()

static array TYPO3\CMS\Core\Utility\MailUtility::parseAddresses (   $rawAddresses)
static

Parses mailbox headers and turns them into an array.

Mailbox headers are a comma separated list of 'name email.nosp@m.@exa.nosp@m.mple..nosp@m.org' combinations or plain email addresses (or a mix of these). The resulting array has key-value pairs where the key is either a number (no display name in the mailbox header) and the value is the email address, or the key is the email address and the value is the display name.

Parameters
string$rawAddresses‪Comma separated list of email addresses (optionally with display name)
Returns
‪array Parsed list of addresses.

Definition at line 171 of file MailUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\MailUtilityTest\parseAddressesTest(), and TYPO3\CMS\Felogin\Controller\FrontendLoginController\sendMail().