‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Mail\MemorySpool Class Reference
Inheritance diagram for TYPO3\CMS\Core\Mail\MemorySpool:
TYPO3\CMS\Core\SingletonInterface TYPO3\CMS\Core\Mail\DelayedTransportInterface TYPO3\CMS\Core\Tests\Unit\Mail\Fixtures\FakeMemorySpoolFixture

Public Member Functions

 __construct (?EventDispatcherInterface $dispatcher=null, protected readonly ?LoggerInterface $logger=null)
 __destruct ()
 flushQueue (TransportInterface $transport)
 __toString ()

Protected Member Functions

 doSend (SentMessage $message)

Protected Attributes

array $queuedMessages = []
int $retries = 3

Detailed Description

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.

This class is experimental and subject to change!

Definition at line 40 of file MemorySpool.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Mail\MemorySpool::__construct ( ?EventDispatcherInterface  $dispatcher = null,
protected readonly ?LoggerInterface  $logger = null 

Create a new MemorySpool

Definition at line 57 of file MemorySpool.php.

◆ __destruct()

TYPO3\CMS\Core\Mail\MemorySpool::__destruct ( )

Sends out the messages in the memory

Reimplemented in TYPO3\CMS\Core\Tests\Unit\Mail\Fixtures\FakeMemorySpoolFixture.

Definition at line 69 of file MemorySpool.php.

References TYPO3\CMS\Core\Mail\MemorySpool\flushQueue().

Member Function Documentation

◆ __toString()

TYPO3\CMS\Core\Mail\MemorySpool::__toString ( )

Definition at line 122 of file MemorySpool.php.

◆ doSend()

TYPO3\CMS\Core\Mail\MemorySpool::doSend ( SentMessage  $message)

Stores a message in the queue.

Definition at line 117 of file MemorySpool.php.

◆ flushQueue()

TYPO3\CMS\Core\Mail\MemorySpool::flushQueue ( TransportInterface  $transport)

Sends messages using the given transport instance

‪int the number of messages sent

Implements TYPO3\CMS\Core\Mail\DelayedTransportInterface.

Definition at line 82 of file MemorySpool.php.

References TYPO3\CMS\Core\Mail\MemorySpool\$retries.

Referenced by TYPO3\CMS\Core\Mail\MemorySpool\__destruct().

Member Data Documentation

◆ $queuedMessages

array TYPO3\CMS\Core\Mail\MemorySpool::$queuedMessages = []

Definition at line 47 of file MemorySpool.php.

◆ $retries

int TYPO3\CMS\Core\Mail\MemorySpool::$retries = 3

Maximum number of retries when the real transport has failed.

Definition at line 52 of file MemorySpool.php.

Referenced by TYPO3\CMS\Core\Mail\MemorySpool\flushQueue().