-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add abiility to set replyTo in mail to form owner (#22)
- Loading branch information
Showing
2 changed files
with
12 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -334,6 +334,7 @@ public function createAction(\Slub\SlubForms\Domain\Model\Email $newEmail, array | |
$this->sendTemplateEmail( | ||
array($newEmail->getSenderEmail() => $newEmail->getSenderName()), | ||
array($this->settings['senderEmailAddress'] => LocalizationUtility::translate('slub-forms.senderEmailName', 'slub_forms') . ' - noreply'), | ||
array() | ||
LocalizationUtility::translate('slub-forms.senderSubject', 'slub_forms') . ' ' . $form->getTitle(), | ||
'ConfirmEmail', | ||
array( 'email' => $newEmail, | ||
|
@@ -350,10 +351,15 @@ public function createAction(\Slub\SlubForms\Domain\Model\Email $newEmail, array | |
if($this->settings['overwriteFromEmailAdressToOwner'] && strlen($this->settings['overwriteFromEmailAdressToOwner']) > 0) { | ||
$senderEmail = $this->settings['overwriteFromEmailAdressToOwner']; | ||
} | ||
$replyto = array(); | ||
if($this->settings['setReplyTo'] && intval($this->settings['setReplyTo']) === 1) { | ||
$replyto = array($newEmail->getSenderEmail() => ''); | ||
} | ||
|
||
$this->sendTemplateEmail( | ||
array($form->getRecipient() => ''), | ||
array($senderEmail => $newEmail->getSenderName()), | ||
$replyto, | ||
LocalizationUtility::translate('tx_slubforms_domain_model_email.form', 'slub_forms') . ': ' . $form->getTitle() . ': '. $newEmail->getSenderName(). ', '. $newEmail->getSenderEmail() , | ||
'FormEmail', | ||
array( 'email' => $newEmail, | ||
|
@@ -440,12 +446,13 @@ public function getSessionData($key) { | |
* | ||
* @param array $recipient recipient of the email in the format array('[email protected]' => 'Recipient Name') | ||
* @param array $sender sender of the email in the format array('[email protected]' => 'Sender Name') | ||
* @param array $replyto replyto of the email in the format array('[email protected]' => 'Sender Name') | ||
* @param string $subject subject of the email | ||
* @param string $templateName template name (UpperCamelCase) | ||
* @param array $variables variables to be passed to the Fluid view | ||
* @return boolean TRUE on success, otherwise false | ||
*/ | ||
protected function sendTemplateEmail(array $recipient, array $sender, $subject, $templateName, array $variables = array()) { | ||
protected function sendTemplateEmail(array $recipient, array $sender, array $replyto, $subject, $templateName, array $variables = array()) { | ||
|
||
/** @var \TYPO3\CMS\Fluid\View\StandaloneView $emailViewHTML */ | ||
$emailViewHTML = $this->objectManager->get(\TYPO3\CMS\Fluid\View\StandaloneView::class); | ||
|
@@ -465,6 +472,8 @@ protected function sendTemplateEmail(array $recipient, array $sender, $subject, | |
|
||
$message->setTo($recipient) | ||
->setFrom($sender) | ||
->setReplyTo($replyto) | ||
->setCharset('utf-8') | ||
->setSubject($subject); | ||
|
||
// Plain text example | ||
|
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 |
---|---|---|
|
@@ -15,6 +15,8 @@ plugin.tx_slubforms { | |
|
||
overwriteFromEmailAdressToOwner = [email protected] | ||
|
||
setReplyTo = 1 | ||
|
||
// allow sending anonymous mails | ||
#anonymEmails { | ||
# allow = 1 | ||
|