[FLOW3-general] Sending Mails with Fluid - where is the proper place in the application architecture?
Bastian Waidelich
bastian at typo3.org
Tue Jan 17 20:35:17 CET 2012
Erik Frister wrote:
Hi Erik,
> I have a question regarding sending mails:
> I have developed a very basic way to send an email to an administrator
> when a user submits a contact form. [...]
> 1. Is this a legitimate way of creating and rendering the Fluid view? Or
> is there a more simple way? I tried using $this->view->renderPartial()
> without success.
From a quick look at your example I can only see a small glitch with
the template path, which would probably be incorrect if $subpackageKey
is not empty.
Apart from that, this seems to be the only way at the moment.
This is an example where the Fluid extension for TYPO3 v4 is ahead:
There we have a "StandaloneView" [1] which can be used like this [2]
Should be fairly easy to forward port this to the package!
> 2. What bothers me most is that the mail-sending logic is inside the
> controller action. [...]
That's true. With a StandaloneView this could be easily extracted to an
independent service.
As an intermediate solution you could make the method a bit more general
(see [2]) and move it to an abstract base controller.
Best,
Bastian
[1]
http://git.typo3.org/TYPO3v4/CoreProjects/MVC/fluid.git?a=blob;f=Classes/View/StandaloneView.php;h=ead396af65272e67a8273a9dd46f8ae285d32f3a;hb=HEAD
[2]
http://forge.typo3.org/projects/typo3v4-mvc/wiki/How_to_use_the_Fluid_Standalone_view_to_render_template_based_emails
More information about the FLOW3-general
mailing list