# Illegal Argument Exception in Watcher Email Service

**URL:** <https://discuss.elastic.co/t/illegal-argument-exception-in-watcher-email-service/91288>\
**Category:** Elasticsearch\
**Created:** [June 29, 2017, 1:40pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-in-watcher-email-service/91288 "2017-06-29T13:40:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![infamous](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@infamous](https://discuss.elastic.co/u/infamous)\
**Post date:** [June 29, 2017, 1:40pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-in-watcher-email-service/91288/1 "2017-06-29T13:40:40Z")

</div>

Hi all,

I am having a bit of trouble with the email action. Here's my .yml config

> `xpack.notification.email.account: outlook_account: profile: outlook smtp: auth: true starttls.enable: true host: smtp-mail.outlook.com port: 587 user: user@domain password: ***** `

Here is my code in watcher

```
{
  "trigger": {
    "schedule": {
      "interval": "10s"
    }
  },
  "input": {
    "search": {
      "request": {
        "search_type": "query_then_fetch",
        "indices": [
          "myindex"
        ],
        "types": [],
        "body": {
          "size": 0,
          "query": {
            "query_string": {
              "query": "Date:[* TO now-7d]"
            }
          }
        }
      }
    }
  },
  "condition": {
    "compare": {
      "ctx.payload.hits.total": {
        "gte": 0
      }
    }
  },
  "actions": {
    "send_email": {
      "email": {
        "account": "outlook_account",
        "profile": "outlook",
        "to": [
          "Name <user@domain>"
        ],
        "subject": "Possible Malfunctioning Codes",
        "body": {
          "text": "There are {{ctx.payload.hits.total}} codes that have not checked in in the last 7 days."
        }
      }
    }
  }
}

```

And here is the error I have

> ```
> "id": "send_email",
> "type": "email",
> "status": "failure",
> "reason": "IllegalArgumentException[no account found for name: [outlook_account]]"
> 
> ```

I saw this thread: [Automated Report Failing](https://discuss.elastic.co/t/automated-report-failing/83093) and it has the exact same issue as I do but I can not replicate his success with the same steps. I am worried I am somehow doing something wrong in the .yml. Please help!

Thanks!

---

<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 30, 2017, 10:13am UTC](https://discuss.elastic.co/t/illegal-argument-exception-in-watcher-email-service/91288/2 "2017-06-30T10:13:41Z")

</div>

can you put the **exact** YAML configuration (including indentation) somewhere in a gist?

---

<div class="post-metadata">

**Author:** ![infamous](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@infamous](https://discuss.elastic.co/u/infamous)\
**Post date:** [June 30, 2017, 1:41pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-in-watcher-email-service/91288/3 "2017-06-30T13:41:39Z")

</div>

```
xpack.notification.email.account:
    outlook_account:
        profile: outlook
        smpt:
            auth: true
            starttls: true
            host: smpt-mail.outlook.com
            port: 587
            user: User@Domain
            password: *****

```

Sorry, here is the part with indentation

---

<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 30, 2017, 4:06pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-in-watcher-email-service/91288/4 "2017-06-30T16:06:33Z")

</div>

Have you put this configuration on all your nodes? Can you run the following commands?

```auto
GET _cat/nodes

GET _nodes?filter_path=**.xpack.notification

```

and paste the output here?

--Alex

---

<div class="post-metadata">

**Author:** ![infamous](https://avatars.discourse-cdn.com/v4/letter/i/df705f/32.png) [@infamous](https://discuss.elastic.co/u/infamous)\
**Post date:** [June 30, 2017, 4:42pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-in-watcher-email-service/91288/5 "2017-06-30T16:42:12Z")

</div>

```
GET _cat/nodes
      127.0.0.1 59 46 10 mdi * K70q9fd

GET _nodes?filter_path=**.xpack.notification
      {}

```

Am I missing something?

---

<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 30, 2017, 4:43pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-in-watcher-email-service/91288/6 "2017-06-30T16:43:19Z")

</div>

hey,

first, did you restart the node after you changed the settings?  
second, which Elasticsearch version is this?

--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 28, 2017, 4:43pm UTC](https://discuss.elastic.co/t/illegal-argument-exception-in-watcher-email-service/91288/7 "2017-07-28T16:43:52Z")

</div>

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