Buenas noches,
Estimados amigos, requiero de su ayuda para solucionar un inconveniente; resulta que quiero enviar un mail, y me sale un errore SMTP Timeout. Cabe resaltar que tengo la aplicación en un hosting de Godaddy. Adjunto la configuración.
// app.php
'EmailTransport' => [
'default' => [
'className' => 'Mail',
// The following keys are used in SMTP transports
'host' => 'localhost',
'port' => 25,
'timeout' => 30,
'username' => null,
'password' => null,
'client' => null,
'tls' => null,
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
],
'laboralmedicmail'=>[
'className' => 'Smtp',
'port' => 465,
'timeout' => 30,
'password' => 'infopassword',
'tls' => true,
],
],
/**
* Email delivery profiles
*
* Delivery profiles allow you to predefine various properties about email
* messages from your application and give the settings a name. This saves
* duplication across your application and makes maintenance and development
* easier. Each profile accepts a number of keys. See `Cake\Mailer\Email`
* for more information.
*/
'Email' => [
'default' => [
'transport' => 'default',
'from' => 'you@localhost',
//'charset' => 'utf-8',
//'headerCharset' => 'utf-8',
],
'laboralmedicMail-profile' => [
'transport' => 'laboralmedicmail',
'charset' => 'utf-8'
],
],
// mi controller
public function sendmail()
{
$msg='<h2>Estimado</h2><p>Se le comunica que se le ha programado el examen médico en la clínica</p>';
$subject='Programación de Examen Médico';
$true=$this->sendUserEmail($to,$subject,$msg);
if($true=='1')
{
$this->Flash->success(__('Mail Send'));
return $this->redirect(['action' => 'index']);
}
else
{
$this->Flash->success(__('Error'));
return $this->redirect(['action' => 'index']);
}
}
public function sendUserEmail($to,$subject,$msg)
{
$email = new Email();
$email
->transport('laboralmedicmail')
->to($to)
->subject($subject)
->emailFormat('html')
->viewVars(array('msg' => $msg))
->send($msg);
return 1;
}
Por favor, estoy contra el tiempo ya que necesito entregar el aplicativo, espero puedan ayudarme. Muchas Gracias.