Sending Email

Friends,

I am trying to use this extension to send emails::

http://www.yiiframework.com/extension/mail

I am using Gmail as smtp server.

I tryed this conf. at main.php:




'mail' => array(

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

   'transportType' => 'php',

   'transportOptions'=>array(

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

          'port_secure'=>true,

          'enc_tls'=>true,

          'username'=>'XXXXXXX',

          'password'=>'XXXXXXX',

          'port'=>587,

    ),

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

    'logging' => true,

    'dryRun' => false



and this is the controller code i am trying to use:




                $emailEnvio = New YiiMailMessage;

                $emailEnvio->view = 'emailEnvioDeArquivo';

                $emailEnvio->setBody();

                $emailEnvio->from = "XXXXXX@XXXXXXXX.XXX";


                $emailContato = Emailcontato::model()->findAllByAttributes(array('id_email'=>$email->id));

                if(!empty($emailContato)){

                    foreach($emailContato as $ec){

                        $endereco = Pagamarela::model()->findByPk($ec->id_pagamarela);

                        Yii::log($endereco->email, 'info', 'email');

                        $emailEnvio->addBcc($endereco->email);

                    }

                }

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



I received this error:

mail() [<a href=‘function.mail’>function.mail</a>]: Failed to connect to mailserver at &quot;localhost&quot; port 25, verify your &quot;SMTP&quot; and &quot;smtp_port&quot; setting in php.ini or use ini_set()

Help please.

You need to set the transport type to ‘smtp’ :)

‘php’ is local sendmail.

For sure!

And put this on main.php:

‘encryption’=>‘tls’,

with

‘port’=>465,

instend of

‘port’=>587,