Monday, January 25, 2010

Re: Multiple Email with Cakephp component

Not quite clear on your question but...

To send multiple emails in a loop
$this->Email->reset()
see http://book.cakephp.org/view/528/Sending-Multiple-Emails-in-a-loop

To add multiple recipients to a single email, I use a comma separated list.

There is also
$this->Email->cc
$this->Email->bcc

On Sun, Jan 24, 2010 at 4:24 PM, alex <genale@gmail.com> wrote:
> Hi... I have an issue about multiple send...my view call a function
> called simplesendmail:
>
> [code]
>
>        function sendSimpleMail($id = null) {
>
>                $list = $this->Content->query("SELECT * FROM mails WHERE sub =
> '1'");
>                $data = $this->Content->find($id);
>
>                /* SMTP Options */
>                $this->Email->smtpOptions = array(
>                  .....
>                   ....
>                );
>
>                foreach($list as $info){
>                        $this->Email->to = $info['mails']['mail'];
>                }
>
>            $this->Email->subject = 'Test - Mailing List';
>            $this->Email->replyTo = 'Test@ Test.org';
>            $this->Email->from = 'Test < Test@ Test.it>';
>
>                /* Set delivery method */
>                $this->Email->delivery = 'smtp';
>                $this->Email->template = 'html/default';
>                $this->Email->sendAs = 'html';
>                $this->set('title', $data['Content']['titolo']);
>                $this->set('content_for_layout', $data['Content']['descrizione']);
>                $this->set('image', $data['Content']['link']);
>
>            if ( $this->Email->send() ) {
>                $this->Session->setFlash('Simple email sent');
>            } else {
>                $this->Session->setFlash('Simple email not sent');
>            }
>                $this->redirect(array('action'=>'index'));
>        }
>
> [/code]
>
> it works for a single send.... i modified the simple send adding the
> follow code:
>
> [code]
>                foreach($list as $info){
>                        $this->Email->to = $info['mails']['mail'];
>                }
> [/code]
>
> where $info is an array of emails...
>
> how can i add multiple recipients for a multiple send ?
>
> Thanks
>
> 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
>

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: