Watcher Send to Multiple Emails Action

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.

Hey,

you can use an array, see the email address docs.

--Alex

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

Address List:

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

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

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! :smile: