Sunday, June 13, 2010

Re: cakePHP emai component

Because $this->set in model != $this->set in controller. You should
set() varibales for template from controller. set() from model sets
data for DB.

Use it from controller.

On Jun 14, 10:00 am, Dmitry Shevchenko <dmitr...@gmail.com> wrote:
> I have tried to import email component in my model, and seems all is
> ok, except I CAN'T send data to template,
> but sender addr, subject and other looks ok. I do this like:
>
>            App::import('Component', 'Email');
>             $this->Email = new EmailComponent();
>             $this->Email->to = $to;
>             $this->Email->subject = $emailSubject;
>             $this->Email->replyTo = $replyToEmail;
>             $this->Email->from = $from;
>             $this->Email->template = $templateName;
>             $this->Email->sendAs = $sendAs;
>             $this->set('data', $data);
>
>             $this->Email->send();
>
> Wnen I'm do a debug I'm getting :
>
> View Object
> (
>     [base] =>
>     [here] =>
>     [plugin] =>
>     [name] =>
>     [action] =>
>     [params] => Array
>         (
>         )
>
>     [passedArgs] => Array
>         (
>         )
>
>     [data] => Array
>         (
>         )
>
>     [helpers] => Array
>         (
>             [0] => Html
>         )
>
>     [viewPath] =>  ...
>  ....
>
> with the warnings
> Notice (8): Trying to get property of non-object [ROOT\cake\cake\libs
> \controller\components\email.php, line 363]
> Notice (8): Trying to get property of non-object [ROOT\cake\cake\libs
> \controller\components\email.php, line 370]
> Notice (8): Undefined property: View::$webroot [ROOT\cake\cake\libs
> \view\view.php, line 755]
>
> Could someone help me.
>
> Also, When I'm try to send email from other controller = all works
> perfectly

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate