-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an example how to change the receiver of a powermail
- Loading branch information
1 parent
10efbfc
commit 9edecca
Showing
3 changed files
with
56 additions
and
7 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
namespace In2code\Powermailextended\Domain\Service; | ||
|
||
use In2code\Powermail\Domain\Model\Mail; | ||
use TYPO3\CMS\Core\Mail\MailMessage; | ||
|
||
/** | ||
* SendMailService | ||
* | ||
* @package powermailextend | ||
*/ | ||
class SendMailService { | ||
|
||
/** | ||
* Manipulate message object short before powermail send the mail | ||
* | ||
* @param MailMessage $message | ||
* @param array $email | ||
* @param Mail $mail | ||
* @param array $settings | ||
* @param string $type Email to "sender" or "receiver" | ||
*/ | ||
public function manipulateMail($message, $email, $mail, $settings, $type) { | ||
// overwrite the receiver | ||
$message->setTo( | ||
array( | ||
'anotheremail@domain.org' => 'receiverName' | ||
) | ||
); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
<?php | ||
// enable SignalSlot | ||
//$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Extbase\SignalSlot\Dispatcher'); | ||
/** | ||
* Register some Slots | ||
*/ | ||
/** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */ | ||
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager') | ||
->get('TYPO3\\CMS\\Extbase\\SignalSlot\Dispatcher'); | ||
|
||
// Manipulate a value before sending | ||
//$signalSlotDispatcher->connect( | ||
// 'In2code\Powermail\Controller\FormController', | ||
// 'createActionBeforeRenderView', | ||
// 'In2code\Powermailextended\Controller\FormController', | ||
// 'manipulateMailObjectOnCreate', | ||
// FALSE | ||
//); | ||
|
||
// Change receiver mail | ||
//$signalSlotDispatcher->connect( | ||
// 'In2code\Powermail\Domain\Service\SendMailService', | ||
// 'sendTemplateEmailBeforeSend', | ||
// 'In2code\Powermailextended\Domain\Service\SendMailService', | ||
// 'manipulateMail', | ||
// FALSE | ||
//); |