Or you could make it a Component itself.
class MailComponent extends Object {
var $components = array('Email');
function simplemail($to, $subject, $body) {
$mail_settings = Configure::read('Mail');
$this-Email-from= $mail_settings['from_name'] .
' ' .
Controllers are not intended to be 'utility' I think you're going
about things the wrong way. Components are intended to be 'utility
classes' and components can have components. Realistically the only
time you should be manually constructing a controller is for unit
testing. Outside of that
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() {
...
I think you are getting a little confused between controller and
components. Your simplemail function could be placed inside the
'Email' component. And you could use the simplemail function in other
controllers by importing the component (and not the controller)
App::import('Component','Email')