‪TYPO3CMS  9.5
MemorySpool.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 namespace ‪TYPO3\CMS\Core\Mail;
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 use Psr\Log\LoggerAwareInterface;
19 use Psr\Log\LoggerAwareTrait;
23 
36 class ‪MemorySpool extends \Swift_MemorySpool implements ‪SingletonInterface, LoggerAwareInterface
37 {
39  use LoggerAwareTrait;
40 
44  public function ‪sendMessages()
45  {
46  $mailer = GeneralUtility::makeInstance(Mailer::class);
47  try {
48  $this->flushQueue($mailer->getRealTransport());
49  } catch (\Swift_TransportException $exception) {
50  $this->logger->error('An Exception occurred while flushing email queue: ' . $exception->getMessage());
51  }
52  }
53 
54  public function ‪__destruct()
55  {
56  $this->‪sendMessages();
57  }
58 }
‪TYPO3\CMS\Core\Mail\MemorySpool
Definition: MemorySpool.php:37
‪TYPO3\CMS\Core\Security\BlockSerializationTrait
Definition: BlockSerializationTrait.php:28
‪TYPO3\CMS\Core\Mail\MemorySpool\sendMessages
‪sendMessages()
Definition: MemorySpool.php:44
‪TYPO3\CMS\Core\SingletonInterface
Definition: SingletonInterface.php:22
‪TYPO3\CMS\Core\Mail\MemorySpool\__destruct
‪__destruct()
Definition: MemorySpool.php:54
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Mail
Definition: Mailer.php:2