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('[email protected]' => 'MySite.com'))
            ->to('[email protected]')
            ->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' => '[email protected]',
        '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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to