‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Mail\FileSpool Class Reference
Inheritance diagram for TYPO3\CMS\Core\Mail\FileSpool:
TYPO3\CMS\Core\Mail\DelayedTransportInterface TYPO3\CMS\Core\Tests\Unit\Mail\Fixtures\FakeFileSpoolFixture

Public Member Functions

 __construct (protected string $path, ?EventDispatcherInterface $dispatcher=null, protected readonly ?LoggerInterface $logger=null)
 
 setRetryLimit (int $limit)
 
 recover (int $timeout=900)
 
 flushQueue (TransportInterface $transport)
 
 setMessageLimit (int $limit)
 
 getMessageLimit ()
 
 setTimeLimit (int $limit)
 
 getTimeLimit ()
 
 __toString ()
 

Protected Member Functions

 doSend (SentMessage $message)
 
 getRandomString (int $count)
 

Protected Attributes

int $retryLimit = 10
 
int $messageLimit
 
int $timeLimit
 

Detailed Description

Inspired by SwiftMailer, adapted for TYPO3 and Symfony/Mailer

This class is experimental and subject to change!

Definition at line 38 of file FileSpool.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Mail\FileSpool::__construct ( protected string  $path,
?EventDispatcherInterface  $dispatcher = null,
protected readonly ?LoggerInterface  $logger = null 
)

Create a new FileSpool, storing messages in $path.

Definition at line 58 of file FileSpool.php.

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

Member Function Documentation

◆ __toString()

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

Definition at line 221 of file FileSpool.php.

◆ doSend()

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

Stores a message in the queue.

Definition at line 73 of file FileSpool.php.

References TYPO3\CMS\Core\Mail\FileSpool\getRandomString().

◆ flushQueue()

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

Sends messages using the given transport instance

Returns
‪int the number of messages sent

Implements TYPO3\CMS\Core\Mail\DelayedTransportInterface.

Definition at line 128 of file FileSpool.php.

References $GLOBALS, TYPO3\CMS\Core\Mail\FileSpool\getMessageLimit(), and TYPO3\CMS\Core\Mail\FileSpool\getTimeLimit().

◆ getMessageLimit()

TYPO3\CMS\Core\Mail\FileSpool::getMessageLimit ( )

Gets the maximum number of messages to send per flush.

Definition at line 200 of file FileSpool.php.

References TYPO3\CMS\Core\Mail\FileSpool\$messageLimit.

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

◆ getRandomString()

TYPO3\CMS\Core\Mail\FileSpool::getRandomString ( int  $count)
protected

Returns a random string needed to generate a fileName for the queue.

Definition at line 176 of file FileSpool.php.

Referenced by TYPO3\CMS\Core\Mail\FileSpool\doSend().

◆ getTimeLimit()

TYPO3\CMS\Core\Mail\FileSpool::getTimeLimit ( )

Gets the time limit (in seconds) per flush.

Definition at line 216 of file FileSpool.php.

References TYPO3\CMS\Core\Mail\FileSpool\$timeLimit.

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

◆ recover()

TYPO3\CMS\Core\Mail\FileSpool::recover ( int  $timeout = 900)

Execute a recovery if for any reason a process is sending for too long.

Parameters
int$timeout‪in second Defaults is for very slow smtp responses

Definition at line 114 of file FileSpool.php.

◆ setMessageLimit()

TYPO3\CMS\Core\Mail\FileSpool::setMessageLimit ( int  $limit)

Sets the maximum number of messages to send per flush.

Definition at line 192 of file FileSpool.php.

◆ setRetryLimit()

TYPO3\CMS\Core\Mail\FileSpool::setRetryLimit ( int  $limit)

Allow to manage the enqueuing retry limit.

Default is ten and allows over 64^20 different fileNames

Definition at line 104 of file FileSpool.php.

◆ setTimeLimit()

TYPO3\CMS\Core\Mail\FileSpool::setTimeLimit ( int  $limit)

Sets the time limit (in seconds) per flush.

Definition at line 208 of file FileSpool.php.

Member Data Documentation

◆ $messageLimit

int TYPO3\CMS\Core\Mail\FileSpool::$messageLimit
protected

The maximum number of messages to send per flush

Definition at line 48 of file FileSpool.php.

Referenced by TYPO3\CMS\Core\Mail\FileSpool\getMessageLimit().

◆ $retryLimit

int TYPO3\CMS\Core\Mail\FileSpool::$retryLimit = 10
protected

File WriteRetry Limit.

Definition at line 43 of file FileSpool.php.

◆ $timeLimit

int TYPO3\CMS\Core\Mail\FileSpool::$timeLimit
protected

The time limit per flush

Definition at line 53 of file FileSpool.php.

Referenced by TYPO3\CMS\Core\Mail\FileSpool\getTimeLimit().