# java.lang.IllegalArgumentException: no accounts of type \[email\] configured. Please set up an account using the \[xpack.notification.email\] settings

**URL:** <https://discuss.elastic.co/t/java-lang-illegalargumentexception-no-accounts-of-type-email-configured-please-set-up-an-account-using-the-xpack-notification-email-settings/123798>\
**Category:** Elasticsearch\
**Created:** [March 13, 2018, 8:02pm UTC](https://discuss.elastic.co/t/java-lang-illegalargumentexception-no-accounts-of-type-email-configured-please-set-up-an-account-using-the-xpack-notification-email-settings/123798 "2018-03-13T20:02:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [March 13, 2018, 8:02pm UTC](https://discuss.elastic.co/t/java-lang-illegalargumentexception-no-accounts-of-type-email-configured-please-set-up-an-account-using-the-xpack-notification-email-settings/123798/1 "2018-03-13T20:02:49Z")

</div>

I followed [Email Action | X-Pack for the Elastic Stack [6.2] | Elastic](https://www.elastic.co/guide/en/x-pack/current/actions-email.html#gmail), yet keep getting following error:

> esd4 | [2018-03-13T19:24:15,542][ERROR][o.e.x.w.a.e.ExecutableEmailAction] [esd4] failed to execute action [WDuSnqbkQbinQ5vLtLpqag\_elasticsearch\_cluster\_status/send\_email\_to\_admin]  
> esd4 | java.lang.IllegalArgumentException: no accounts of type [email] configured. Please set up an account using the [xpack.notification.email] settings

my email account settings are:

```
xpack.notification.email.account.gmail.profile=gmail
xpack.notification.email.account.gmail.smtp.user=X
xpack.notification.email.account.gmail.smtp.password=X

```

Please advise.

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [March 15, 2018, 7:54pm UTC](https://discuss.elastic.co/t/java-lang-illegalargumentexception-no-accounts-of-type-email-configured-please-set-up-an-account-using-the-xpack-notification-email-settings/123798/2 "2018-03-15T19:54:49Z")

</div>

Configured the gmail account set up in elasticsearch.yml and allowed 2 step verification for it.

```auto
xpack.notification:
   email.account.gmail_account:
       smtp:
            auth: true
            starttls.enable: true
            host: smtp.gmail.com
            port: 587
            user: xxx@gmail.com
            password: xxxxxx

```

This config worked for me on 6.2 and I do receive emails via watcher email action. Can you please verify your config?

Thanks  
Rashmi

---

<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:** [March 15, 2018, 9:13pm UTC](https://discuss.elastic.co/t/java-lang-illegalargumentexception-no-accounts-of-type-email-configured-please-set-up-an-account-using-the-xpack-notification-email-settings/123798/3 "2018-03-15T21:13:39Z")

</div>

Common sources of mistakes here:

First, is this configuration of **all** of your nodes.  
Second, did you restart **all** your nodes after applying this change?

If you do not fancy restarts and do not want to store these settings in the yaml file, you can also use the [cluster update settings API](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cluster-update-settings.html) to add a new email account. This also has the advantage, that it gets distributed to all nodes without you having to do anything.

---

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [March 16, 2018, 6:37pm UTC](https://discuss.elastic.co/t/java-lang-illegalargumentexception-no-accounts-of-type-email-configured-please-set-up-an-account-using-the-xpack-notification-email-settings/123798/4 "2018-03-16T18:37:32Z")

</div>

I saw following in logs:

```
esd4 | [2018-03-16T18:29:58,318][ERROR][o.e.x.w.a.e.ExecutableEmailAction] [esd4] failed to execute action [WDuSnqbkQbinQ5vLtLpqag_elasticsearch_nodes/send_email_to_admin]
esd4 | javax.mail.MessagingException: failed to send email with subject [X-Pack Monitoring: Nodes Changed (WDuSnqbkQbinQ5vLtLpqag)] via account [gmail_account]
esd4 | at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:112) ~[?:?]
esd4 | at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:104) ~[?:?]
esd4 | at org.elasticsearch.xpack.watcher.actions.email.ExecutableEmailAction.execute(ExecutableEmailAction.java:84) ~[?:?]
esd4 | at org.elasticsearch.xpack.core.watcher.actions.ActionWrapper.execute(ActionWrapper.java:156) ~[x-pack-core-6.2.2.jar:6.2.2]
esd4 | at org.elasticsearch.xpack.watcher.execution.ExecutionService.executeInner(ExecutionService.java:492) ~[x-pack-watcher-6.2.2.jar:6.2.2]
esd4 | at org.elasticsearch.xpack.watcher.execution.ExecutionService.execute(ExecutionService.java:322) ~[x-pack-watcher-6.2.2.jar:6.2.2]
esd4 | at org.elasticsearch.xpack.watcher.execution.ExecutionService.lambda$executeAsync$7(ExecutionService.java:426) ~[x-pack-watcher-6.2.2.jar:6.2.2]
esd4 | at org.elasticsearch.xpack.watcher.execution.ExecutionService$WatchExecutionTask.run(ExecutionService.java:580) [x-pack-watcher-6.2.2.jar:6.2.2]
esd4 | at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:573) [elasticsearch-6.2.2.jar:6.2.2]
esd4 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_161]
esd4 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_161]
esd4 | at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]
esd4 | Caused by: javax.mail.AuthenticationFailedException: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbtX
esd4 | 534-5.7.14 NsungKoIYLSu6BRWb1zr4FZU9tzbKYSqiPZPznda9k_KbJc5OfPs5UMvB3QIIXaBrR-oYf
esd4 | 534-5.7.14 1qI-VtUumWZkZlZYAwnEu2_oLgTAN_1BaiNwm5apFh4lYIOluOe79ZsAsNpbWoWNBAMa13
esd4 | 534-5.7.14 YnaJ5mMwCNSaA8G6WXWddyCLOWJlWPBC_5IwYj5MVTKQ9R4ALmv6ezbooFlsqTMGjV4Nbn
esd4 | 534-5.7.14 n5rs5SKh-2m7Fv-on7S9MlAyYaLRU> Please log in via your web browser and
esd4 | 534-5.7.14 then try again.
esd4 | 534-5.7.14 Learn more at
esd4 | 534 5.7.14 https://support.google.com/mail/answer/78754 x10sm844763ual.46 - gsmtp
esd4 | 
esd4 | at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:932) ~[?:?]
esd4 | at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:843) ~[?:?]
esd4 | at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:748) ~[?:?]
esd4 | at javax.mail.Service.connect(Service.java:366) ~[?:?]
esd4 | at org.elasticsearch.xpack.watcher.notification.email.Account.lambda$executeConnect$2(Account.java:166) ~[?:?]
esd4 | at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_161]
esd4 | at org.elasticsearch.xpack.watcher.notification.email.Account.executeConnect(Account.java:165) ~[?:?]
esd4 | at org.elasticsearch.xpack.watcher.notification.email.Account.send(Account.java:124) ~[?:?]
esd4 | at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:110) ~[?:?]
esd4 | ... 11 more
```

---

<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:** [March 16, 2018, 7:15pm UTC](https://discuss.elastic.co/t/java-lang-illegalargumentexception-no-accounts-of-type-email-configured-please-set-up-an-account-using-the-xpack-notification-email-settings/123798/5 "2018-03-16T19:15:10Z")

</div>

So this means that your accounts are setup properly in x-pack. This message comes from google and also contains a link that explains the steps you need to do in order to set up this up properly on the google side.

---

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [April 10, 2018, 9:37pm UTC](https://discuss.elastic.co/t/java-lang-illegalargumentexception-no-accounts-of-type-email-configured-please-set-up-an-account-using-the-xpack-notification-email-settings/123798/6 "2018-04-10T21:37:23Z")

</div>

Is there a way to figure out which node(s) is/are miss-configured? As when I try to create new watch via `Kibana`, under action I see grey out message:

> E-mail  
> Disabled. Configure elasticsearch.yml

---

<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:** [April 11, 2018, 7:56am UTC](https://discuss.elastic.co/t/java-lang-illegalargumentexception-no-accounts-of-type-email-configured-please-set-up-an-account-using-the-xpack-notification-email-settings/123798/7 "2018-04-11T07:56:16Z")

</div>

you might want to check the node kibana connects to first in this case.

---

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [April 12, 2018, 3:28pm UTC](https://discuss.elastic.co/t/java-lang-illegalargumentexception-no-accounts-of-type-email-configured-please-set-up-an-account-using-the-xpack-notification-email-settings/123798/8 "2018-04-12T15:28:09Z")

</div>

ha! you were right, I did all nodes, but coordinate node and now that I update it, it shows up as it should)

Thanks!

---

<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:** [May 10, 2018, 3:28pm UTC](https://discuss.elastic.co/t/java-lang-illegalargumentexception-no-accounts-of-type-email-configured-please-set-up-an-account-using-the-xpack-notification-email-settings/123798/9 "2018-05-10T15:28:23Z")

</div>

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