I just upgraded from RC3 to 1.2 final, and I'm getting errors when
sending email.

I have my own component:

class MyEmailComponent extends Object {

        var $components = array ('Email');

        function sendEmail($to,$subject=null) {
                // The calling controller must first set:
                // messageText
                // messageHTML (if blank, messageText is used)
                // msgTitle (optional)
                // subtitle (optional)

                if (!$subject) {
                        $subject = 'A Message from MySite.com';
                }

                $this->Email->to = $to;
                $this->Email->subject = $subject;
                // $this->Email->replyTo = '[email protected]';
                $this->Email->from = '[email protected]';
                $this->Email->layout = 'default';
                $this->Email->template = 'default'; // note no '.ctp'
                // Send as 'html', 'text' or 'both' (default is 'text')
                $this->Email->sendAs = 'both'; // because we like to send pretty
mail

                // Do not pass any args to send()
                if ($this->Email->send()) {
                        return true;
                } else {
                        return false;
                }


        }

}




It is called from a function inside a controller:

        function _notify($message_id) {
                // Send email notification of private message
                $to = $this->PrivateMessage->getRecipientEmail($message_id);
                $subject = 'You have a message on the MySite.com website';
                $this->set('title','A New Private Message is waiting for you on 
the
MySite.com website');
                $this->set('messageText','A new message is waiting for you on 
the
MySite.com website. Log into the member area to view your messages.');
                $this->set('messageHTML','<p>A new message is waiting for you 
on the
<a href="http://MySite.com/privateMessages/";>MySite.com</a>
website.');


                if ($this->MyEmail->sendEmail($to,$subject) ) {
                        return true;
                } else {
                        return false;
                }


        }



It generates these messages:

Notice (8): Undefined property: EmailComponent::$Controller [CORE\cake
\libs\controller\components\email.php, line 352]

Notice (8): Trying to get property of non-object [CORE\cake\libs
\controller\components\email.php, line 352]

Notice (8): Undefined property: EmailComponent::$Controller [CORE\cake
\libs\controller\components\email.php, line 359]
Notice (8): Trying to get property of non-object [CORE\cake\libs
\controller\components\email.php, line 359]


Notice (8): Undefined property: View::$webroot [CORE\cake\libs\view
\view.php, line 751]

Warning (2): Cannot modify header information - headers already sent
by (output started at D:\cakephp\cake\libs\debugger.php:521) [CORE\cake
\libs\controller\controller.php, line 615]


The email is sent, but it has a error message rather than the message
text.


Any suggestions as to where to look for what went wrong?

Thank you so much for your help.

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