Last active
March 18, 2019 19:22
-
-
Save benjaminpick/873aa1d4e13e0da1650afc9c0d493b6f to your computer and use it in GitHub Desktop.
Abort sending Email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */ | |
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\Dispatcher'); | |
$signalSlotDispatcher->connect( | |
'In2code\\Powermail\\Domain\\Service\\Mail\\SendMailService', | |
'sendTemplateEmailBeforeSend', | |
'In2code\\Powermailextended\\Domain\\Service\\SendMailService', | |
'manipulateMail', | |
FALSE | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace In2code\Powermailextended\Domain\Service; | |
use In2code\Powermail\Domain\Service\Mail\SendMailService as SendMailServicePowermail; | |
class SendMailService { | |
public function manipulateMail($message, &$email, SendMailServicePowermail $sendMailService) { | |
if ($email['template'] == 'Mail/OptinMail' && $email['subject'] == 'subject line') { | |
// Never send such Optin mails ... | |
$email['send'] = false; | |
return; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment