Help solve the problem with the message:
Exception:YiiMailMessage and its behaviors do not have a method or closure named "setSubject"
and
Exception:YiiMailMessage and its behaviors do not have a method or closure named "setTo"
and
Exception:YiiMailMessage and its behaviors do not have a method or closure named "setFrom"
In protected/main/config.php:
'import'=>array(
...
'application.extensions.yii-mail.*',
),
...
'components'=>array(
...
'mail' => array(
'class' => 'application.extensions.yii-mail.YiiMail',
'transportType'=>'smtp', /// case sensitive!
'transportOptions'=>array(
'host'=>'smtp.gmail.com',
'username'=>'yourgoogleemail@gmail.com',
// or email@googleappsdomain.com
'password'=>'yourgooglemailpassword',
'port'=>'465',
'encryption'=>'ssl',
),
'viewPath' => 'application.views.mail',
'logging' => true,
'dryRun' => false
),
In controller:
$message = new YiiMailMessage;
//userModel is passed to the view
$message->setBody('My text');
$message->setTo(array($userModel->email=>'My name'));
$message->from = Yii::app()->params['adminEmail'];
Yii::app()->mail->send($message);
The result of the action:
Exception:YiiMailMessage and its behaviors do not have a method or closure named "setSubject"
Exception:YiiMailMessage and its behaviors do not have a method or closure named "setTo"
Exception:YiiMailMessage and its behaviors do not have a method or closure named "setFrom"