cakephpcakephp-2.0cakeemail

CakeEmail reformat before sending


Does anyone know if it is possible to override the message content in CakePHP CakeEmail version 2.9.1?

I'm using a template to format my e-mail which is working great, but just before I send the e-mail I want to encrypt it using GNUPG. The idea was to get the fully rendered message, parse it through my encryption function and then send it, is this possible?

Plan B would be to do everything from the AppShell but I wanted to uterlise the Html helper, is it possible to load this as a Helper in the AppShell.

I'm limited to running inside a plugin as the main application is controlled from a third party.

Thanks in advance.


Solution

  • You can create a custom view class that does it (https://book.cakephp.org/2.0/en/views.html#creating-your-own-view-classes) and pass it to CakeEmail object via viewRender method.