[FEATURE] Add signal for mailer initialization
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Documentation / Changelog / master / Feature-62960-SignalForMailerInitialization.rst
1 ==================================================
2 Feature: #62960 - Signal for mailer initialization
3 ==================================================
4
5 Description
6 ===========
7
8 This signal allows for additional processing upon initialization of a mailer object,
9 e.g. registering a Swift mailer plugin.
10
11 Registering the signal:
12
13 ::
14
15 $signalSlotDispatcher = \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility::makeInstance(\\TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher::class);
16 $signalSlotDispatcher->connect(
17 \\TYPO3\\CMS\\Core\\Mail\\Mailer::class,
18 'postInitializeMailer',
19 \\Vendor\\Package\\Slots\\MailerSlot::class,
20 'registerPlugin'
21 );
22
23 ..
24
25 The slot class:
26
27 ::
28
29 <?php
30 namespace Vendor\\Package\\Slots;
31
32 use TYPO3\\CMS\\Core\\Mail\\Mailer;
33
34 class MailerSlot {
35 /**
36 * @param Mailer $mailer
37 * @return void
38 */
39 public function registerPlugin(Mailer $mailer) {
40 // Processing here
41 }
42 }
43
44 ..
45
46 Impact
47 ======
48
49 Extensions may now perform arbitrary processing for every mail.