Problems with Mail Extension

Hi,

I want to use a widget i a cconsoleapplication (in order to send an email).

my View:


<?php $this->widget('zii.widgets.grid.CGridView', array(...)

my command:


class MailCommand extends CConsoleCommand

{

	public function actionIndex($id) {

		$userModel = User::model()->findByPk($id);

		$message = new YiiMailMessage;

		$message->view = 'users';

 		$user= new CArrayDataProvider(Settings::model()->findAllByAttributes(array('user_id'=>$id)));

 		

 		

		//userModel is passed to the view

		$message->setBody(array('user'=>$user, 'userModel'=>$userModel), 'text/html');

		$message->subject = $userModel->name;

		$message->addTo('test@test.de');

		$message->from = Yii::app()->params['adminEmail'];

		Yii::app()->mail->send($message);

	

	

	

	}


}

When trying to execute I’m getting an CException saying “getWidgetFactory” is not found in CConsoleApplication.

Any ideas on this issue?

‘getWidgetFactory’ belongs to CWidget.

Happy Coding.

Yes, I allready saw this in the docs, but could not get any further… do I need to include this somehow (how?)?