Tuesday, January 26, 2010

Loop Issue Cakephp

Hi, I'm trying to develop a mailing list .... In the controller
CONTENTS there's a function called sendMailingList
[code]
$list = $this->Content->query("SELECT * FROM mails WHERE sub =
'1'");
$data = $this->Content->find($id);

$this->Email->smtpOptions = array(
.....
);

foreach($list as $info){
$this->Email->subject = 'Test';
$this->Email->replyTo = 'no-reply@yyyy.it;
$this->Email->from = 'xxx <xxx@yyyy.it>';

$this->Email->to = 'mailinglist@alexgenovese.it';
$this->Email->delivery = 'smtp';
$this->Email->template = 'html/default';
$this->Email->sendAs = 'html';
$this->Email->to = $info['mails']['mail'];
$this->set('title', $data['Content']['titolo']);
$this->set('content_for_layout', $data['Content']['descrizione']);
$this->set('image', $data['Content']['link']);
$this->set('mail', $this->Email->to);
$this->Email->send();
}

$this->flash(__('Email sent', true), array
('action'=>'index'));
[/code]

it works for one email ( without foreach($list as $info){...} ), but
when i trying to send with this method I see this nex pic...

http://www.flickr.com/photos/davidale/4306633066/

...I wait your answers ....

Thanks a lot!
Alex.

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: