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 "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
Help please.