# Could not connect to SMTP host

**URL:** https://discuss.elastic.co/t/could-not-connect-to-smtp-host/293207
**Category:** Elasticsearch
**Tags:** elastic-stack-alerting
**Created:** [December 30, 2021, 1:35pm UTC](https://discuss.elastic.co/t/could-not-connect-to-smtp-host/293207 "2021-12-30T13:35:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![keyu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/keyu/32/98794_2.png) [@keyu](https://discuss.elastic.co/u/keyu)
#### Post date: [December 30, 2021, 1:35pm UTC](https://discuss.elastic.co/t/could-not-connect-to-smtp-host/293207/1 "2021-12-30T13:35:51Z")

</div>

Hi,

I have configured watcher related alerts. Sending the watcher alert emails from a "[support.test@domain.com](mailto:support.test@domain.com)". Below is the action template I have used in watcher

```auto
"actions": {
    "send_email": {
      "email": {
        "profile": "standard",
        "from": "support.test@domain.com",
        "to": [
         "test.test2@domain.com"
        ],
        "subject": "Watcher alert email",
        "body": {
          "text": "{{ctx.payload.filtered}}"
        }
      }
    }
  }

```

Initially I am able to see the emails are sent to "[test.test2@domain.com](mailto:test.test2@domain.com)" email. But, don't know the reason why it stopped.

When checked in the **Execution History** tab I able to see the email action is failing with error "Could not connect to SMTP host: dockerhost, port: 10025"

```auto
"actions": [
      {
        "id": "send_email",
        "type": "email",
        "status": "failure",
        "error": {
          "root_cause": [
            {
              "type": "messaging_exception",
              "reason": "failed to send email with subject [Watcher alert email] via account [work]"
            }
          ],
          "type": "messaging_exception",
          "reason": "failed to send email with subject [Watcher alert email] via account [work]",
          "caused_by": {
            "type": "messaging_exception",
            "reason": "Could not connect to SMTP host: dockerhost, port: 10025, response: -1"
          }
        }
      }
    ]
  }

```

Please let me know how to fix this. Thanks in advance

Regards,  
Keyu

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [January 5, 2022, 3:42pm UTC](https://discuss.elastic.co/t/could-not-connect-to-smtp-host/293207/2 "2022-01-05T15:42:50Z")

</div>

See this part in your message

> [@keyu](#):
>
> ```auto
> "reason": "Could not connect to SMTP host: dockerhost, port: 10025, response: -1"
> 
> ```

Apparently that host does not exist or cannot be reached over that port.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [February 2, 2022, 3:43pm UTC](https://discuss.elastic.co/t/could-not-connect-to-smtp-host/293207/3 "2022-02-02T15:43:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
