Skip to content

Instantly share code, notes, and snippets.

@benjaminpick
Last active March 18, 2019 19:22
Show Gist options
  • Save benjaminpick/873aa1d4e13e0da1650afc9c0d493b6f to your computer and use it in GitHub Desktop.
Save benjaminpick/873aa1d4e13e0da1650afc9c0d493b6f to your computer and use it in GitHub Desktop.
Abort sending Email
<?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
);
<?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