Search code examples
emailcakephpcakephp-1.3cakephp-1.2bulk

How to send a multiple emails at a time in cakephp


I need to send multiple emails at a time, can any one have example? or any idea ? I need to send mail to all my site users at a time (Mail content is same for all)

Currently i using following code in a for loop

        $this->Email->from     = '<[email protected]>';
        $this->Email->to       =  $email;
        $this->Email->subject  =   $subject ;
        $this->Email->sendAs   = 'html'; 

Solution

  • In Cakephp 2.0 I used the following code:

    $result = $email->template($template, 'default')
        ->emailFormat('html')
        ->to(array('[email protected]', '[email protected]', '[email protected]')))
        ->from($from_email)
        ->subject($subject)
        ->viewVars($data);