Re: Sending Email from Shell

2010-05-21 Thread bujanga
This is the code I use:

//  IMPORT AND INITIALIZE EMAIL COMPONENT
App::import('Core', 'Controller');
App::import('Component', 'Email');
$this->Controller =& new Controller();
$this->Email =& new EmailComponent(null);
$this->Email->initialize($this->Controller);

A few minor differences from yours. Maybe give it a try.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Sending Email from Shell

2010-05-21 Thread Jesse
I have recently upgraded my cake core from cake-1.2.0.7962 to cake 1.2
6.

The only problem I've had in converting everything is my custom shells
that I have written.

I have a shell that searches a database, returns records and sends out
email for people to renew their account. It's pretty simple.

The problem comes when trying to send the email. Here is my code from
the old cake core that worked in sending out the email:

App::import('Core', array('Controller'));
App::import('Component', array('Email'));
$this->Controller =& new Controller();
$this->Email =& new EmailComponent();
$this->Email->startup($this->Controller);

$this->Email->reset();
$this->Email->to = 'Jesse ';
$this->Email->subject = "Subject";
$this->Email->replyTo = "t...@example.com";
$this->Email->from = "t...@example.com";
$this->Email->template = 'default';
$this->Email->sendAs = "html";
$this->Email->send();

This worked flawlessly for over a year, sent out thousands of email
and I never had a problem with it. After upgrading I keep getting this
error:

Notice: Undefined property: EmailComponent::$Controller in /usr/local/
cake_1.2.6/cake/libs/controller/components/email.php on line 363
Notice: Trying to get property of non-object in /usr/local/cake_1.2.6/
cake/libs/controller/components/email.php on line 363
Notice: Undefined property: EmailComponent::$Controller in /usr/local/
cake_1.2.6/cake/libs/controller/components/email.php on line 370
Notice: Trying to get property of non-object in /usr/local/cake_1.2.6/
cake/libs/controller/components/email.php on line 370
Notice: Undefined property: View::$webroot in /usr/local/cake_1.2.6/
cake/libs/view/view.php on line 755
Notice: Undefined property: View::$webroot in /usr/local/cake_1.2.6/
cake/libs/view/view.php on line 755

The email is still sent out but it contains some errors as well and
I'm thinking it has to do with these errors. I didn't realize this was
broken until we rolled it out into production so we haven't been able
to send the emails out for a couple days. Anyone have some advice for
me?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en