Hello,
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->addTo('xxx@gmail.com');
$message->from = Yii::app()->params['adminEmail'];
Yii::app()->mail->send($message);
Main
'import'=>array(
'ext.yii-mail.YiiMailMessage',
),
'components'=>array(
'mail' => array(
'class' => 'ext.yii-mail.YiiMail', //'class' => 'ext.yii-mail.YiiMail',
'transportType' => 'smtp',
'transportOptions'=>array(
'host'=>'smtp.gmail.com',
'encryption'=>'ssl', // use ssl
'username'=>'xxx@gmail.com',
'password'=>'123456',
'port'=>465, // ssl port for gmail
),
'viewPath' => 'application.views.mail',
'logging' => true,
'dryRun' => false
),
),
Error:
CException
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,