Yii-Mail - Cexception


I’m using the Yii-mail http://www.yiiframework.com/extension/mail/ to send email but i’m facing a CException Error “Property “CWebApplication.mail” is not defined.” I already saw the post http://www.yiiframework.com/forum/index.php/topic/36166-property-cwebapplicationmail-is-not-defined/ and couldn’t get it to work. Can someone help me, please?

I’ve configured the extension as show below:

Contact page:

$message = new YiiMailMessage;

$message->setBody('Message content here with HTML', 'text/html');

$message->subject = 'My Subject';


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







	'mail' => array(

		'class' => 'ext.yii-mail.YiiMail', //'class' => 'ext.yii-mail.YiiMail',

		'transportType' => 'smtp',



			'encryption'=>'ssl', // use ssl



		'port'=>465, // ssl port for gmail


 		'viewPath' => 'application.views.mail',

		'logging' => true,

		'dryRun' => false





Property "CWebApplication.mail" is not defined. 


public function __get($name)

101     {

102         if($this->hasComponent($name))

103             return $this->getComponent($name);

104         else

105             return parent::__get($name);

106     }

Thank you, i appreciated any kind of help,

You don’t have the ‘components’ key defined more than once in the configuration array do you?


Yes i have, with the ‘user’=>array, ‘db’=>array, etc., but those where already there in the base configuration and everything works just fine until i see the page with the code to send the message.

You need to define the extra configuration as part of the same array.

Move ‘mail’ in alongside ‘user’ etc.

It was that :) it’s working! Thank you very much Keith for your help :)