# Watcher Send to Multiple Emails Action

**URL:** <https://discuss.elastic.co/t/watcher-send-to-multiple-emails-action/61736>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [September 28, 2016, 7:53pm UTC](https://discuss.elastic.co/t/watcher-send-to-multiple-emails-action/61736 "2016-09-28T19:53:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmbtenorio](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@mmbtenorio](https://discuss.elastic.co/u/mmbtenorio)\
**Post date:** [September 28, 2016, 7:53pm UTC](https://discuss.elastic.co/t/watcher-send-to-multiple-emails-action/61736/1 "2016-09-28T19:53:10Z")

</div>

Hello! I have a problem regarding sending to multiple emails. The watch can be put to the elasticsearch, but once you execute it, the email action will report an error:

```
{
        "id": "email_admin",
        "type": "email",
        "status": "failure",
        "reason": "AddressException[Illegal address]"
}

```

Below is my configuration:

```
"email_admin": { 
     "email": {
            "to" : "'Name 1 <email>', 'Name2 <email>' ", 
            "subject" : "{{ctx.watch_id}} executed", 
            "body" : "message" 
      }
}

```

This is what I have in the elasticsearch.yml:

```
watcher.actions.email.service.account:
    work:
        profile: gmail
        email_defaults:
            from: 'Name <username@gmail.com>'
        smtp:
            auth: true
            starttls.enable: true
            host: smtp.gmail.com
            port: 587
            user: username@gmail.com
            password: <password>

```

I want to know if this is the right way of doing it. I need to notify several people, hence, multiple emails should be considered in the "to" field of the action. By the way, I also tried to send to just one email, and I didn't come up with an error.

---

<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:** [September 29, 2016, 7:08am UTC](https://discuss.elastic.co/t/watcher-send-to-multiple-emails-action/61736/2 "2016-09-29T07:08:48Z")

</div>

Hey,

you can use an array, see the [email address docs](https://www.elastic.co/guide/en/watcher/2.4/actions.html#email-address).

--Alex

---

<div class="post-metadata">

**Author:** ![mmbtenorio](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@mmbtenorio](https://discuss.elastic.co/u/mmbtenorio)\
**Post date:** [September 30, 2016, 10:22am UTC](https://discuss.elastic.co/t/watcher-send-to-multiple-emails-action/61736/3 "2016-09-30T10:22:21Z")

</div>

Sorry, I can't seem to get the docs. How can I do it using array?

---

<div class="post-metadata">

**Author:** ![Marten](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@Marten](https://discuss.elastic.co/u/Marten)\
**Post date:** [September 30, 2016, 11:35am UTC](https://discuss.elastic.co/t/watcher-send-to-multiple-emails-action/61736/4 "2016-09-30T11:35:56Z")

</div>

Address List:

A list of addresses can be specified as an array: ['user1@host.domain', 'user2@host.domain']

---

<div class="post-metadata">

**Author:** ![mmbtenorio](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@mmbtenorio](https://discuss.elastic.co/u/mmbtenorio)\
**Post date:** [September 30, 2016, 5:30pm UTC](https://discuss.elastic.co/t/watcher-send-to-multiple-emails-action/61736/5 "2016-09-30T17:30:31Z")

</div>

I tried to do what you suggested, but I'm still getting the same error

---

<div class="post-metadata">

**Author:** ![mmbtenorio](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@mmbtenorio](https://discuss.elastic.co/u/mmbtenorio)\
**Post date:** [September 30, 2016, 5:53pm UTC](https://discuss.elastic.co/t/watcher-send-to-multiple-emails-action/61736/6 "2016-09-30T17:53:46Z")

</div>

I browsed some of the topics related to my question. I found out that this was already resolved.  
It should be:

`"to" : ["name1@email", "name2@email"]`

Thanks to your help and suggestions! 😄

---

<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 6, 2017, 1:42pm UTC](https://discuss.elastic.co/t/watcher-send-to-multiple-emails-action/61736/7 "2017-07-06T13:42:43Z")

</div>


