2
votes

3 I am getting error in sending mail.here below i have mentioned my code.

in controller file var $components = array('RequestHandler', 'Filter','Image','Email','Captcha','RandomHelper');

then in my function i have write $this->Email->from = $from;

$this->Email->subject = 'Approval Form: ';


$this->Email->delivery = 'debug';


$this->Email->template = 'adminemail';


$this->Email->sendAs = 'html';


$this->Email->send();

i dont want to send mail using SMTP. when i run this code the error is for missing helper file it tel me "rror: The helper file app/views/helpers/email.php can not be found or does not exist." Anyone can pls help me

2

2 Answers

0
votes

Email is not a helper, it was a component in 1.3 and in 2.0 there is CakeEmail

You do not load helpers in the component property, use public $helpers = array('MyHelper');

Helpers are loaded without the "Helper" suffix in the $helpers property.

It looks like you do not have any idea of what MVC is or what the difference between helpers and components are. I suggest you to read about MVC and CakePHPs different parts like what the difference is between a component and a helper and a behavior for example.

0
votes

Please refer to CakePHP 2.x Documentation about CakeMail or to the CakePHP 1.3 Documentation about the Email Core Component if you are using this version of CakePHP.

(Cake)Email has never been a Helper, Helper are for Views, Component are for Controllers, Behavior for Models.

They allow you to externalize part of the logic to reuse it somewhere else.

In Views, you can also use Elements for elements you use often.