I have a controller EmailNotifications which I am accessing using App::Import('Controller', 'EmailNotifications');
The EmailNotifications controller uses the Email component var $components = array('Email', 'RequestHandler'); When I import the controller I use the following code: // Load the Email Notification controller App::Import('Controller', 'EmailNotifications'); $EmailNotification = new EmailNotificationsController(); $EmailNotification->constructClasses(); Inside of the notify method of the EmailNotificationsController I use the Email component $this->Email->reset(); $this->Email->to = $Notify['EmailNotification']['email_address']; $this->Email->subject = ucwords("$Subject ($Activity)"); $this->Email->replyTo = $Notify['EmailNotification']['email_address']; $this->Email->from = $Notify['EmailNotification']['email_address']; $this->Email->template = $Template; $this->Email->sendAs = 'text'; // Since this is being used via App::Import the Controller is not properly set // so we set it here $this->Email->Controller = $this; $Ret = $this->Email->send(); If I do not manually set $this->Email->Controller = $this before calling send the variables I have set earlier in the code are not exported to the email view. >From reading the manual I understood that calling constructClasses would initialize any models and components used by the controller. However, the components do not seem to be initialized correctly. Is there something else I am supposed to do in order for this to work correctly? Is this a bug? I am using CakePHP 1.3.10 -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.