Issue Bug Closed

#69395EXT:form - Allow ReplyTo

Christian Hernmarck 08/28/15, 16:06 updated 10/02/18, 11:34

Description

With the former mailform there was an option to set the “replyto” mail header field (needed because of SPF).

In the new form this is not yet implemented – so it’s not possible to send mails where you can answer to the entered mail address by just hitting “reply” (without running into problems with SPF – eg. xxx@gmx.net as entered mail address).

Here’s a simple patch, adopted from the “setFrom()” method.

--- typo3_src-6.2.14/typo3/sysext/form/Classes/PostProcess/MailPostProcessor.php.orig   2015-07-01 16:40:01.000000000 +0200
+++ typo3_src-6.2.14/typo3/sysext/form/Classes/PostProcess/MailPostProcessor.php        2015-08-28 15:56:48.456316401 +0200
@@ -71,6 +71,7 @@
                $this->setFrom();
                $this->setTo();
                $this->setCc();
+               $this->setReplyTo();
                $this->setPriority();
                $this->setOrganization();
                // @todo The whole content rendering seems to be missing here!
@@ -195,6 +196,24 @@
        }

        /**
+        * Sets the replyto of the mail message
+        *
+        * Checks the address if it is a valid email address
+        *
+        * @return void
+        */
+       protected function setReplyTo() {
+               $replytoEmail = '';
+               if ($this->typoScript['replytoEmail']) {
+                       $replytoEmail = $this->typoScript['replytoEmail'];
+               } elseif ($this->requestHandler->has($this->typoScript['replytoEmailField'])) {
+                       $replytoEmail = $this->requestHandler->get($this->typoScript['replytoEmailField']);
+               } 
+               $replytoName = '';
+               $this->mailMessage->setReplyTo($replytoEmail, $replytoName);
+       }
+
+       /**
         * Set the priority of the mail message
         *
         * When not in settings, the value will be 3. If the priority is configured,

The replyToName was also possible – but I can live without that :-)

Also see: #68771

Reviews 1