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