[TYPO3-mvc] Mailing from the scheduler

Henjo Hoeksma | Stylence me at henjohoeksma.nl
Wed Feb 6 18:57:45 CET 2013


When you use the Fluid Standalone Template you have to fully reference your
labels, that is, using the full path.
I saw in the latest versions you can also add extensionName attribute to
the viewhelper thus overriding the default extensionName. Not sure if this
works in standalone view as well though.

Kind regards,

Henjo

Problems are small because we learned how to deal with them.
Problems are big because we need to learn how to deal with them.


On Wed, Feb 6, 2013 at 3:41 PM, Tobias Liebig <tobias.liebig at typo3.org>wrote:

> Hej,
>
> compared with a MailService i did some time ago, i have this additional
> line of code, right before rendering the view:
>
> $emailView->getRequest()->setControllerExtensionName($this->extensionName);
>
> Maybe that helps.
>
> kind regards
>    Tobias
>
>
> Am 05.02.2013 um 22:02 schrieb Lars Nieuwenhuizen <
> lars.nieuwenhuizen at me.com>:
>
> > Good day,
> >
> > I have a question regarding the following:
> >
> > I have a scheduler class which extends Tx_Extbase_Scheduler_Task
> > In this class i've created an email function:
> >
> > ################################
> >
> >       /**
> >        * Send email
> >        *
> >        * @param User $recipient
> >        * @param array $sender
> >        * @param string $subject
> >        * @param string $templateName
> >        * @param $templateType
> >        * @param array $variables
> >        * @return boolean
> >        */
> >       protected function sendTemplateEmail($recipient, array $sender,
> $subject, $templateName, $templateType, array $variables = array()) {
> >               $emailView =
> $this->objectManager->create('Tx_Fluid_View_StandaloneView');
> >
> >               $emailView->setFormat($templateType);
> >
> >               $templateRootPath =
> t3lib_div::getFileAbsFileName('EXT:extension/Resources/Private/Templates/');
> >               $templateLayoutRootPath =
> t3lib_div::getFileAbsFileName('EXT:extension/Resources/Private/Layouts/');
> >               $templatePartialRootPath =
> t3lib_div::getFileAbsFileName('EXT:extension/Resources/Private/Partials/');
> >
> >               $templatePathAndFilename = $templateRootPath . 'Email/' .
> $templateName . '.html';
> >               $emailView->setLayoutRootPath($templateLayoutRootPath);
> >               $emailView->setPartialRootPath($templatePartialRootPath);
> >
> $emailView->setTemplatePathAndFilename($templatePathAndFilename);
> >
> >               $emailView->assignMultiple($variables);
> >               $emailView->assign('webUser', $recipient);
> >
> >               $emailBody = $emailView->render();
> >
> >               $message = t3lib_div::makeInstance('t3lib_mail_Message');
> >
> >               $message->setTo($recipient->getEmail())
> >                       ->setFrom($sender)
> >                       ->setSubject($subject);
> >               // Plain text example
> >               $message->setBody($emailBody, 'text/' . $templateType);
> >
> >               $message->send();
> >               return $message->isSent();
> >       }
> >
> > ################################
> >
> > When the mail is sent, i receive the email without any of the language
> labels. My urls that fluid should format are messed up.
> > The entire email is wasted… Probably because it is all outside of the
> scope. Is there any way to make this work?
> >
> > Thanks in advance,
> >
> > Lars Nieuwenhuizen
> > _______________________________________________
> > TYPO3-project-typo3v4mvc mailing list
> > TYPO3-project-typo3v4mvc at lists.typo3.org
> > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>
> --
> Tobias Liebig
> TYPO3 Core Team member
>
> TYPO3 .... inspiring people to share!
> Get involved: typo3.org
>
> http://bit.ly/supportTYPO3
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>


More information about the TYPO3-project-typo3v4mvc mailing list