sending email

In config:


'components' => array(

        'messages' => array(

            'class' => 'CPhpMessageSource'),

        'email' => array(

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

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

            'transportOptions'=>array(

                'host'=>'smtp.gmail.com',

                'username'=>'zipzapduo@gmail.com',

                'password'=>'password',

                'port'=>'587',

                'encryption'=>'ssl',

            ),

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

        'logging' => true,

        'dryRun' => false,

view:


$message = new YiiMailMessage;




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


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

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

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

i have the following directory structure:

extensions\yii-mail\YiiMail.php

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?


Yii::import('ext.yii-mail.YiiMailMessage');

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://smtp.gmail.com:465 (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.

Solved

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