Writing an app where I was planing to move all email delivering in one
controller. When I try to load this "Utility" controller in a function
from another controller. App::import fail to load Email component in
this controller

Controller 1:
<code>
function send_message() {
...
App::import('Controller', 'Main');
$main = new MainController;
$main->simplemail($to, $subject, $body);
}
</code>

Utility controller:
<code>
class MainController extends AppController {

var $name = 'Main';
var $components = array('Email');
var $uses = null;
...
function simplemail($to, $subject, $body) {
                $mail_settings = Configure::read('Mail');
                $this->Email->from    = $mail_settings['from_name'] . ' <' .
$mail_settings['from_mail'] . '>';
                $this->Email->to      = $to;
                $this->Email->subject = $subject;
                debug($this->Email);
                //$this->Email->send($body);

        }

</code>



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to