Something I have wondered as well. From some light research it seems
ROR uses ActionMailer::Base subclassed as a model that renders views.

Maybe someone from the cake core can give their opinion.

Alternatively, you could create a Email model which saves info to the
database, which is then read from a shell scheduled in cron to send
the actual emails :)

Adam

On May 7, 11:13 pm, dericknwq <[EMAIL PROTECTED]> wrote:
> There are times where I seriously feel the need to send an email from
> the model like at the afterSave() stage or something. Say each time a
> new comment is added to a post, a notification will be sent to
> participants depending on certain conditions. It just feels more
> correct having those checks and sending of emails in the model.
>
> E.g. Controller:
>
> $this->Model->saveThis($someComment);
> if ($this->Model->shouldSendNotification()) {
>   $data = $this->Model->getNecessaryData();
>   $this->__sendNotificationWithEmailComponent($data);
>
> }
>
> Why not have saveThis() do the work and send the notifications? I do
> think that it will be possible to just pass the Email component into
> the model but is that technically correct? How did you do yours?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to