Mailer

class \TYPO3\CMS\Core\Mail\Mailer

Implements
MailerInterface

Adapter for Symfony/Mailer to be used by TYPO3 extensions.

This will use the setting in TYPO3_CONF_VARS to choose the correct transport for it to work out-of-the-box.

Attributes

#[AsAlias]
\TYPO3\CMS\Core\Mail\MailerInterface::class
$public: true
#[Autoconfigure]
$public: true

Table of Contents

Interfaces

MailerInterface
Interface for mailers for sending emails. This should be used when injecting or creating an instance of the Mailer class, so it can be easily overridden.

Properties

$eventDispatcher  : EventDispatcherInterface|null
$mailerHeader  : string
This will be added as X-Mailer to all outgoing mails
$mailSettings  : array
$sentMessage  : SentMessage|null
$transport  : TransportInterface|null

Methods

__construct()  : mixed
When constructing, also initializes the Symfony Transport like configured
getRealTransport()  : TransportInterface
Returns the real transport (not a spool).
getSentMessage()  : SentMessage|null
getTransport()  : TransportInterface
injectMailSettings()  : mixed
Falls back to the global MAIL configuration when no settings are given.
send()  : void
getTransportFactory()  : TransportFactory

Properties

$eventDispatcher read-only

protected EventDispatcherInterface|null $eventDispatcher = null

$mailerHeader

This will be added as X-Mailer to all outgoing mails

protected string $mailerHeader = 'TYPO3'

$mailSettings

protected array $mailSettings = []

$sentMessage

protected SentMessage|null $sentMessage

$transport

protected TransportInterface|null $transport = null

Methods

__construct()

When constructing, also initializes the Symfony Transport like configured

public __construct([TransportInterface|null $transport = null ][, EventDispatcherInterface|null $eventDispatcher = null ][, array|null $mailSettings = null ]) : mixed

Parameters

$transport : TransportInterface|null = null

optionally pass a transport to the constructor.

$eventDispatcher : EventDispatcherInterface|null = null
$mailSettings : array|null = null

optionally pass mail settings, defaults to the global MAIL configuration.

Tags

throws
Exception

getRealTransport()

Returns the real transport (not a spool).

public getRealTransport() : TransportInterface

Return values

TransportInterface

getSentMessage()

public getSentMessage() : SentMessage|null

Return values

SentMessage|null

getTransport()

public getTransport() : TransportInterface

Return values

TransportInterface

injectMailSettings()

Falls back to the global MAIL configuration when no settings are given.

public injectMailSettings([array|null $mailSettings = null ]) : mixed

Parameters

$mailSettings : array|null = null
On this page