# Help me! cakephp Email - Godaddy Hosting

**URL:** <https://discourse.cakephp.org/t/help-me-cakephp-email-godaddy-hosting/5022>\
**Category:** Need Help\
**Created:** [September 29, 2018, 7:27pm UTC](https://discourse.cakephp.org/t/help-me-cakephp-email-godaddy-hosting/5022 "2018-09-29T19:27:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaVi](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@MaVi](https://discourse.cakephp.org/u/MaVi)\
**Post date:** [September 29, 2018, 7:27pm UTC](https://discourse.cakephp.org/t/help-me-cakephp-email-godaddy-hosting/5022/1 "2018-09-29T19:27:17Z")

</div>

Hello,

I require your help to solve a problem; It turns out that I want to send an email, and I get an error “SMTP Timeout”. It should be noted that I have the application in a hosting of Godaddy. I attach the configuration.

// 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',

'host' => 'a2plcpnl0421.prod.iad2.secureserver.net',

'port' => 465,

'timeout' => 30,

'user' => 'info@laboralmedic.com',

'password' => ' ********',

'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',

        'from' => 'info@laboralmedic.com',

        'charset' => 'utf-8'

  ],

    ],

```

// my controller

```
public function sendmail()

    {        

        $msg='Estimado;Se le comunica que se le ha programado el examen médico en la clínica';

        $subject='Programación de Examen Médico';

        $to='vito2100@gmail.com';

        $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')

            ->from(['info@laboralmedic.com' => 'info@laboralmedic.com'])

            ->to($to)

            ->subject($subject)

             ->emailFormat('html')

            ->viewVars(array('msg' => $msg))

            ->send($msg);         

            return 1;

    }

```

Please, I am against the time since I need to deliver the application, I hope you can help me. Thank you so much.

---

<div class="post-metadata">

**Author:** ![FinlayDaG33k](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/finlaydag33k/32/1049_2.png) [@FinlayDaG33k](https://discourse.cakephp.org/u/FinlayDaG33k)\
**Post date:** [September 30, 2018, 6:43pm UTC](https://discourse.cakephp.org/t/help-me-cakephp-email-godaddy-hosting/5022/2 "2018-09-30T18:43:00Z")

</div>

a `timeout` means that the server couldn’t be reached within a reasonable time.  
Are you sure you’ve entered the right `host` and `port`?

---

<div class="post-metadata">

**Author:** ![MaVi](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@MaVi](https://discourse.cakephp.org/u/MaVi)\
**Post date:** [September 30, 2018, 8:40pm UTC](https://discourse.cakephp.org/t/help-me-cakephp-email-godaddy-hosting/5022/3 "2018-09-30T20:40:44Z")

</div>

Hi,

Yes, I configured the parameters according to the attachment.

![Captura](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex029/uploads/cakephp/original/2X/5/51f2ca9672e8f1ddb7c29cac7d1653cb4d5b3a7d.png)

---

<div class="post-metadata">

**Author:** ![FinlayDaG33k](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/finlaydag33k/32/1049_2.png) [@FinlayDaG33k](https://discourse.cakephp.org/u/FinlayDaG33k)\
**Post date:** [October 1, 2018, 6:06am UTC](https://discourse.cakephp.org/t/help-me-cakephp-email-godaddy-hosting/5022/4 "2018-10-01T06:06:34Z")

</div>

Hm… that’s odd…  
Could you add a `log` statement to the email?

```php
$email
  ->viewVars(...)
  ->log(true)
  ->send($msg)

```

This will add it to the CakePHP logs, could you give the output of it to us? (please be sure to redact any sensitive info if any)

---

<div class="post-metadata">

**Author:** ![MaVi](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@MaVi](https://discourse.cakephp.org/u/MaVi)\
**Post date:** [October 2, 2018, 2:55am UTC](https://discourse.cakephp.org/t/help-me-cakephp-email-godaddy-hosting/5022/5 "2018-10-02T02:55:58Z")

</div>

I try add log but an error ocurred:

# Call to undefined method Cake\Mailer\Email::log()

---

<div class="post-metadata">

**Author:** ![MaVi](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@MaVi](https://discourse.cakephp.org/u/MaVi)\
**Post date:** [October 2, 2018, 5:48am UTC](https://discourse.cakephp.org/t/help-me-cakephp-email-godaddy-hosting/5022/6 "2018-10-02T05:48:42Z")

</div>

I solved the problem. Thanks for your help.

---

<div class="post-metadata">

**Author:** ![FinlayDaG33k](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/finlaydag33k/32/1049_2.png) [@FinlayDaG33k](https://discourse.cakephp.org/u/FinlayDaG33k)\
**Post date:** [October 2, 2018, 6:08am UTC](https://discourse.cakephp.org/t/help-me-cakephp-email-godaddy-hosting/5022/7 "2018-10-02T06:08:20Z")

</div>

> [@MaVi](#):
>
> I solved the problem

Would you mind posting the solution for future visitors?

---

<div class="post-metadata">

**Author:** ![MaVi](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@MaVi](https://discourse.cakephp.org/u/MaVi)\
**Post date:** [October 12, 2018, 8:40pm UTC](https://discourse.cakephp.org/t/help-me-cakephp-email-godaddy-hosting/5022/8 "2018-10-12T20:40:43Z")

</div>

I configured SSL in Hosting, and used port 25.
