[TYPO3-mvc] How I can send a message from a field to mail body?

Дмитрий Васильев dmitry at typo3.ru.net
Wed Dec 12 21:49:39 CET 2012


Hi all,
I make extension with the questions list.
I want to send the text, from the form to the admin email

To send mail using this function in controller

     /**
      * send email using swiftmailer
      *
      * @param string $recipientEmail
      * @param string $subject
      * @param string $message
      * @param string $senderEmail
      * @param string $senderName
      * @return void
      */
     protected function sendMail($senderEmail, $recipientEmail, 
$subject, $message) {
         $mail = t3lib_div::makeInstance('t3lib_mail_Message');
         $mail->setFrom( array( $this->settings['senderEmail'] => 
$this->settings['senderName'] ) );
         $mail ->setTo($this->settings['recipientEmail']);
         $mail->setSubject($this->settings['subject']);
         $mail->setBody($message);
         $mail->send();
     }

In new action use

public function newAction(Tx_Userfaq_Domain_Model_Question $newQuestion 
= NULL) {
     ....
     $this->sendMail($senderEmail, $recipientEmail, $subject, $message);
     ....
}

How I can send a message from a field 
name="tx_userfaq_userfaq[newQuestion][description]" to mail body?

----------------------------------
Thanks, Dmitry Vasiliev


More information about the TYPO3-project-typo3v4mvc mailing list