‪TYPO3CMS  10.4
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 (string $path, EventDispatcherInterface $dispatcher=null, LoggerInterface $logger=null)
 
 setRetryLimit (int $limit)
 
 recover (int $timeout=900)
 
 flushQueue (TransportInterface $transport)
 
 setMessageLimit (int $limit)
 
int getMessageLimit ()
 
 setTimeLimit (int $limit)
 
int getTimeLimit ()
 
 __toString ()
 

Protected Member Functions

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

Protected Attributes

string $path
 
LoggerInterface $logger
 
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 39 of file FileSpool.php.

Constructor & Destructor Documentation

◆ __construct()

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

Create a new FileSpool.

Parameters
string$path
EventDispatcherInterface$dispatcher
LoggerInterface$logger

Definition at line 75 of file FileSpool.php.

References TYPO3\CMS\Core\Mail\FileSpool\$logger, TYPO3\CMS\Core\Mail\FileSpool\$path, and TYPO3\CMS\Core\Utility\GeneralUtility\mkdir_deep().

Member Function Documentation

◆ __toString()

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

Definition at line 259 of file FileSpool.php.

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

◆ doSend()

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

Stores a message in the queue.

Parameters
SentMessage$message

Definition at line 94 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

Parameters
TransportInterface$transport
Returns
‪int the number of messages sent

Implements TYPO3\CMS\Core\Mail\DelayedTransportInterface.

Definition at line 154 of file FileSpool.php.

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

◆ getMessageLimit()

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

Gets the maximum number of messages to send per flush.

Returns
‪int The limit

Definition at line 234 of file FileSpool.php.

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

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

◆ getRandomString()

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

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

Parameters
int$count
Returns
‪string

Definition at line 206 of file FileSpool.php.

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

◆ getTimeLimit()

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

Gets the time limit (in seconds) per flush.

Returns
‪int The limit

Definition at line 254 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 137 of file FileSpool.php.

◆ setMessageLimit()

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

Sets the maximum number of messages to send per flush.

Parameters
int$limit

Definition at line 224 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

Parameters
int$limit

Definition at line 127 of file FileSpool.php.

◆ setTimeLimit()

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

Sets the time limit (in seconds) per flush.

Parameters
int$limit‪The limit

Definition at line 244 of file FileSpool.php.

Member Data Documentation

◆ $logger

LoggerInterface TYPO3\CMS\Core\Mail\FileSpool::$logger
protected

The logger instance.

Definition at line 50 of file FileSpool.php.

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

◆ $messageLimit

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

The maximum number of messages to send per flush

Definition at line 61 of file FileSpool.php.

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

◆ $path

◆ $retryLimit

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

File WriteRetry Limit.

Definition at line 56 of file FileSpool.php.

◆ $timeLimit

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

The time limit per flush

Definition at line 66 of file FileSpool.php.

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