MemorySpool

class \TYPO3\CMS\Core\Mail\MemorySpool

Extends
AbstractTransport
Implements
DelayedTransportInterface
Uses
BlockSerializationTrait

Because TYPO3 doesn't offer a terminate signal or hook, and taking in account the risk that extensions do some redirects or even exit, we simply use the destructor of a singleton class which should be pretty much at the end of a request.

To have only one memory spool per request seems to be more appropriate anyway.

Table of Contents

Interfaces

DelayedTransportInterface
Used to implement backwards-compatible spooling

Properties

$logger  : LoggerInterface|null
$queuedMessages  : SentMessage[]
$retries  : int
Maximum number of retries when the real transport has failed.

Methods

__construct()  : mixed
__destruct()  : mixed
Sends out the messages in the memory
__toString()  : string
__unserialize()  : void
Deny object deserialization.
flushQueue()  : int
Sends messages using the given transport instance
doSend()  : void
Stores a message in the queue.

Properties

$logger read-only

protected LoggerInterface|null $logger = null

$queuedMessages

protected SentMessage[] $queuedMessages = []

$retries

Maximum number of retries when the real transport has failed.

protected int $retries = 3

Methods

__construct()

public __construct([EventDispatcherInterface|null $dispatcher = null ][, LoggerInterface|null $logger = null ][, callable(): TransportInterface|null $realTransportFactory = null ]) : mixed

Parameters

$dispatcher : EventDispatcherInterface|null = null
$logger : LoggerInterface|null = null
$realTransportFactory : callable(): TransportInterface|null = null

creates the transport the queue is flushed through, defaults to the one of the global mailer

__destruct()

Sends out the messages in the memory

public __destruct() : mixed

__toString()

public __toString() : string

Return values

string

__unserialize()

Deny object deserialization.

public __unserialize(array $data) : void

Parameters

$data : array

flushQueue()

Sends messages using the given transport instance

public flushQueue(TransportInterface $transport) : int

Parameters

$transport : TransportInterface

Return values

int —

the number of messages sent

doSend()

Stores a message in the queue.

protected doSend(SentMessage $message) : void

Parameters

$message : SentMessage
On this page