Cron & Shell -> Mail
Hi, here is my problem:
I send an email using a Shell which is done by a Cron job.
Nothing special, unless I'd like to use a template for my email where I send several variables using set() method.
This is how I do it:
App::import('Core', 'Controller'); App::import('Component', 'Email'); $this->Controller =& new Controller(); $this->Email =& new EmailComponent(null); $this->Email->initialize($this->Controller); $this->Email->charset = 'ISO-8859-1'; $this->Email->to = $winner['User']['email']; $this->Email->subject = 'Félicitations!'; $this->Email->from = 'blabla <email@example.com>'; $this->Email->template = 'winner'; $this->Email->sendAs = 'html'; $this->set('winner', $winner); $this->Email->send();
And Cron sends me back:
Fatal error: Call to undefined method WinnerShell::set()
Could anyone help me with this?
Asked by renardthis, on 11/6/10
Try using this
Answered by rickydunlopon 11/6/10