sending email

In config:

'components' => array(

        'messages' => array(

            'class' => 'CPhpMessageSource'),

        'email' => array(

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

            'transportType'=>'smtp', /// case sensitive!








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

        'logging' => true,

        'dryRun' => false,


$message = new YiiMailMessage;

                $message->setBody('My text');

                $message->setTo(array($model->email => 'My name'));

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


i have the following directory structure:


and the error:

include(YiiMailMessage.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory

Do you, in your view, also include YiiMailMessage class like this?


No.It is that and is not in the view but instead int he controller,my mistake

Now i have this error:


fsockopen() [<a href=‘function.fsockopen’>function.fsockopen</a>]: unable to connect to ssl:// (Unable to find the socket transport &quot;ssl&quot; - did you forget to enable it when you configured PHP?) "

i have tested with some port numbers and i have openssl.dll enabled on php.ini

I had a similar problem in YII in LAMP.I just found a solution by omitting the ‘port’ option in array ‘transportOptions’ when using

GMAIL server.

I removed.It’s the same

My error now with fake send email:

fsockopen() [<a href=‘function.fsockopen’>function.fsockopen</a>]: SSL operation failed with code 1. OpenSSL Error messages:

error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

SSL not installed or configured in php.ini as extension.


In ‘transportOptions’ => array(‘encryption’=>‘ssl’) <= encryption value is case sensitive