# Xpack watcher email notifications with Mailgun 6.3

**URL:** <https://discuss.elastic.co/t/xpack-watcher-email-notifications-with-mailgun-6-3/136505>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [June 19, 2018, 2:03pm UTC](https://discuss.elastic.co/t/xpack-watcher-email-notifications-with-mailgun-6-3/136505 "2018-06-19T14:03:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeremy\_Foran](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeremy_foran/32/15434_2.png) [@Jeremy\_Foran](https://discuss.elastic.co/u/Jeremy_Foran)\
**Post date:** [June 19, 2018, 2:03pm UTC](https://discuss.elastic.co/t/xpack-watcher-email-notifications-with-mailgun-6-3/136505/1 "2018-06-19T14:03:55Z")

</div>

It took me a bit to get this working and thought I would share my working config for the benefit of the community.

```
2018-06-18T15:31:22,758][ERROR][o.e.x.w.a.e.ExecutableEmailAction] [es5-data-03] failed to execute action [f4b4d37a-c1b7-4426-adf3-7880aa549039/email_1]
javax.mail.MessagingException: failed to send email with subject [Watch [testing] has exceeded the threshold] via account [mailgun_account]
	at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:154) ~[?:?]
	at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:146) ~[?:?]
	at org.elasticsearch.xpack.watcher.actions.email.ExecutableEmailAction.execute(ExecutableEmailAction.java:84) ~[?:?]
	at org.elasticsearch.xpack.core.watcher.actions.ActionWrapper.execute(ActionWrapper.java:156) ~[x-pack-core-6.2.4.jar:6.2.4]
	at org.elasticsearch.xpack.watcher.execution.ExecutionService.executeInner(ExecutionService.java:487) ~[x-pack-watcher-6.2.4.jar:6.2.4]
	at org.elasticsearch.xpack.watcher.execution.ExecutionService.execute(ExecutionService.java:317) ~[x-pack-watcher-6.2.4.jar:6.2.4]
	at org.elasticsearch.xpack.watcher.execution.ExecutionService.lambda$executeAsync$6(ExecutionService.java:421) ~[x-pack-watcher-6.2.4.jar:6.2.4]
	at org.elasticsearch.xpack.watcher.execution.ExecutionService$WatchExecutionTask.run(ExecutionService.java:575) [x-pack-watcher-6.2.4.jar:6.2.4]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:573) [elasticsearch-6.2.4.jar:6.2.4]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_171]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_171]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]
Caused by: javax.mail.MessagingException: can't determine local email address
	at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1704) ~[?:?]
	at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1257) ~[?:?]
	at org.elasticsearch.xpack.watcher.notification.email.Account.send(Account.java:147) ~[?:?]
	at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:152) ~[?:?]
	... 11 more

```

This is the configuration I used to resolve the issue:

```
xpack.notification.email.account:
    mailgun_account:
        email_defaults:
            from: watcher@domain.com
        smtp:
            auth: true
            host: smtp.mailgun.org
            port: 587
            user: watcher@domain.com
            password: password
```

---

<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:** [June 22, 2018, 2:00pm UTC](https://discuss.elastic.co/t/xpack-watcher-email-notifications-with-mailgun-6-3/136505/2 "2018-06-22T14:00:26Z")

</div>

Hey,

just to be sure: Everything is working now? So with the configuration you pasted below, the above exception does not happen, correct?

It depends a bit on the email provider, if a default email address is used or not, thus we do not do this check in watcher itself.

--Alex

---

<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:** [July 20, 2018, 2:25pm UTC](https://discuss.elastic.co/t/xpack-watcher-email-notifications-with-mailgun-6-3/136505/4 "2018-07-20T14:25:17Z")

</div>

Closed on July 20, 2018, 2:25pm UTC

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