CakeEmail: getting error using example from Cake Book
Asked this on Q&A also, but aren't sure which is more accurate/
appropriate place...
New to Cake and trying to learn by implementing some basic
functions... Trying out the CakeEmail function and getting the
following error:
Fatal error: Call to a member function send() on a non-object
in /var/www/app/Model/Request.php on line 241
Called from the Request controller like this:
$this->Request->sendEmail(); // Send a confirmation email
Request Model method looks like this:
App::uses('AppModel', 'Model');
App::uses('CakeEmail', 'Network/Email');
// ... bunch of other functions
public function sendEmail() {
$email = new CakeEmail('gmail');
$email->from(array('my@email.com' => 'MySite.com'))
->to('my@email.com')
->subject('Request Created')
->message('Your request created successfully')
->send('My Message');
}
New to this so it's probably something basic... But I'm out of ideas.
Thanks in advance for the help
PS: also created the email.php as described...
public $gmail = array(
'host' => 'ssl://smtp.gmail.com',
'port' => 465,
'username' => 'my@email.com',
'password' => 'not telling',
'transport' => 'Smtp'
);
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
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

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home