CakePHP using Email component from Shell cronjob

前端 未结 4 1389
萌比男神i
萌比男神i 2021-01-02 01:19

I\'m trying to send an email from a CakePHP shell just as you would from the Controller.

Most of the code below was adapted from this dated article on the Bakery an

4条回答
  •  悲&欢浪女
    2021-01-02 01:50

    Try this.

    App::import('Core', 'Controller');
    App::import('Component', 'Email');
    $this->Controller =& new Controller();
    $this->Email =& new EmailComponent(null);
    $this->Email->initialize($this->Controller);    
    
    //use set function as below  
    $this->controller->set('result', $results[$i]);
    

    for more reference click on below link:

    http://ask.cakephp.org/questions/view/cron_shell_-_mail

提交回复
热议问题