I haven't been able to get any email success within a loop. On Dec 17, 5:01 am, John Andersen <[email protected]> wrote: > Do you in your code have another example where you can send an email > with success? > Enjoy, > John > > On Dec 17, 8:22 am, damanlovett <[email protected]> wrote: > > > I'm new to cake and this is my first mass email function. I'm trying > > to send emails to a group of users based on a habtm table I am getting > > the error: > > > Fatal error: Call to undefined method stdClass::send() in /hermes/ > > bosweb/web037/b374/ipw.ncaieorg/public_html/members/app/controllers/ > > expertises_controller.php on line 50 > > > I"m trying to loop the email so it will grab the email address and > > send out a batch of emails. The form has a drop down with the areas > > that the members belong to. Here's my code for the function. > > > function post() { > > $this->Expertise->recursive = 0; > > if (!empty($this->data)){ > > $data = $this->paginate('Expertise', array('Expertise.area_id > > LIKE' => $this->data['Expertise']['area_id'])); > > $this->set('expertises', $data); > > $areas = $this->Expertise->Area->find('list', array > > ('Expertise.area_id LIKE' => $this->data['Expertise']['area_id'])); > > $this->set(compact('areas','expertises')); > > > foreach ($areas as $area){ > > > $this->Email->to = $area['username']; > > $this->Email->subject = > > $this->data['Expertise']['subject']; > > $this->Email->replyTo = '[email protected]'; > > $this->Email->from = 'LCCM System > > <[email protected]>'; > > $this->Email->template = 'default'; // note no '.ctp' > > //Send as 'html', 'text' or 'both' (default is 'text') > > $this->Email->sendAs = 'both'; // because we like to > > send pretty > > mail > > //Set view variables as normal > > //$this->set('User', $User); > > //Do not pass any args to send() > > $this->Email->send(); > > $this->Email->reset(); > > > } > > > Any help would be greatly appreciated.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
