# Email sending failed on my watcher alert

**URL:** <https://discuss.elastic.co/t/email-sending-failed-on-my-watcher-alert/221501>\
**Category:** Elasticsearch\
**Created:** [February 29, 2020, 2:15am UTC](https://discuss.elastic.co/t/email-sending-failed-on-my-watcher-alert/221501 "2020-02-29T02:15:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark.quilates](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark.quilates/32/24802_2.png) [@mark.quilates](https://discuss.elastic.co/u/mark.quilates)\
**Post date:** [February 29, 2020, 2:15am UTC](https://discuss.elastic.co/t/email-sending-failed-on-my-watcher-alert/221501/1 "2020-02-29T02:15:20Z")

</div>

Hi,

I have configured my watcher in my ELK stack 7.6.0 installed that in my Ubuntu 18.04 LTS.

my elasticsearch.yml config.

```
xpack.watcher.enabled: true

xpack.notification.email.account:
    gmail_account:
        profile: gmail
        smtp:
            auth: true
            starttls.enable: true
            host: smtp.gmail.com
            port: 587
            user: m **** @gmail.com

```

I have already had my gmail app password and inputted using this command:

`/usr/share/elasticsearch/bin/elasticsearch-keystore add xpack.notification.email.account.gmail_account.smtp.secure_password`

When I tried to send test email I got this error _Failed to send email to_

and got this on elasticsearch logs:

`Caused by: javax.mail.MessagingException: can't determine local email address`

Anyone can help me please to fixed this issue. Thanks!

---

<div class="post-metadata">

**Author:** ![ropc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ropc/32/47022_2.png) [@ropc](https://discuss.elastic.co/u/ropc)\
**Post date:** [March 1, 2020, 2:08am UTC](https://discuss.elastic.co/t/email-sending-failed-on-my-watcher-alert/221501/2 "2020-03-01T02:08:36Z")

</div>

@mark.quilates - This issue could be related to this [Discuss topic](https://discuss.elastic.co/t/cant-send-email-from-x-pack-to-gmail/108257/2). In a nutshell, you would need to set the `from` parameter in the [email action](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/actions-email.html#email-action-attributes) in your watch implementation. You could also use the `email_defaults` parameter in the [email account configuration](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/actions-email.html#configuring-email) in the `elasticsearch.yml` file.

I hope that helps.

---

<div class="post-metadata">

**Author:** ![mark.quilates](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark.quilates/32/24802_2.png) [@mark.quilates](https://discuss.elastic.co/u/mark.quilates)\
**Post date:** [March 1, 2020, 9:12am UTC](https://discuss.elastic.co/t/email-sending-failed-on-my-watcher-alert/221501/3 "2020-03-01T09:12:35Z")

</div>

Hi @ropc,

Thank you for your replied. But, I have already configured the "To" parameter in the Kibana GUI. Also used the gmail default setting. However still not works.

Please take a look on my screenshot. Still got, "Failed to send email to" Error.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/7/970405237cefed5dbe29af096f7696dac58174e7.png)

---

<div class="post-metadata">

**Author:** ![ropc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ropc/32/47022_2.png) [@ropc](https://discuss.elastic.co/u/ropc)\
**Post date:** [March 3, 2020, 2:25am UTC](https://discuss.elastic.co/t/email-sending-failed-on-my-watcher-alert/221501/4 "2020-03-03T02:25:19Z")

</div>

@mark.quilates - When you click on the `Send test email` and observe the `Failed to send email to...` error message, can you check the Elasticsearch logs? There should be a corresponding error message related to this email action. Please provide the error message details observed in Elasticsearch logs.

---

<div class="post-metadata">

**Author:** ![mark.quilates](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark.quilates/32/24802_2.png) [@mark.quilates](https://discuss.elastic.co/u/mark.quilates)\
**Post date:** [March 3, 2020, 2:31am UTC](https://discuss.elastic.co/t/email-sending-failed-on-my-watcher-alert/221501/5 "2020-03-03T02:31:17Z")

</div>

Hi @ropc,

That one I got i my elasticsearch log.

`Caused by: javax.mail.MessagingException: can't determine local email address`

I don't know why its happening because I've already configured the default setting based on the documentation.

---

<div class="post-metadata">

**Author:** ![ropc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ropc/32/47022_2.png) [@ropc](https://discuss.elastic.co/u/ropc)\
**Post date:** [March 3, 2020, 3:21am UTC](https://discuss.elastic.co/t/email-sending-failed-on-my-watcher-alert/221501/6 "2020-03-03T03:21:23Z")

</div>

@mark.quilates - I would appreciate if you can send the entire stack trace message from the Elasticsearch logs. That might give us more information about the actual problem.

Note:

- assuming that your Gmail account has a default `from` email address set-up, then it should work? Unless there is something unexpected happening there (entire logs would help...).
- you could try to configure the email account with `email_defaults` and `from` parameters and see if the behavior is different.

---

<div class="post-metadata">

**Author:** ![mark.quilates](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark.quilates/32/24802_2.png) [@mark.quilates](https://discuss.elastic.co/u/mark.quilates)\
**Post date:** [March 3, 2020, 1:46pm UTC](https://discuss.elastic.co/t/email-sending-failed-on-my-watcher-alert/221501/7 "2020-03-03T13:46:24Z")

</div>

Hi @ropc,

Its working now. Thank you very much for your help.

I just added the `email_defaults` and `from` on my elasticsearch email config. Thanks again!

---

<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:** [March 31, 2020, 1:46pm UTC](https://discuss.elastic.co/t/email-sending-failed-on-my-watcher-alert/221501/8 "2020-03-31T13:46:27Z")

</div>

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