# Email action: AddressException\[Illegal address\] when sending to address list

**URL:** https://discuss.elastic.co/t/email-action-addressexception-illegal-address-when-sending-to-address-list/24452
**Category:** Elasticsearch
**Tags:** elastic-stack-alerting
**Created:** [June 26, 2015, 6:12pm UTC](https://discuss.elastic.co/t/email-action-addressexception-illegal-address-when-sending-to-address-list/24452 "2015-06-26T18:12:21Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![cciaccio](https://avatars.discourse-cdn.com/v4/letter/c/ccd318/32.png) [@cciaccio](https://discuss.elastic.co/u/cciaccio)
#### Post date: [June 26, 2015, 6:12pm UTC](https://discuss.elastic.co/t/email-action-addressexception-illegal-address-when-sending-to-address-list/24452/1 "2015-06-26T18:12:21Z")

</div>

I keep getting the AddressException[Illegal address] error when I try to send alerts to multiple email addresses.

This is the "to" attribute in my email action:

"to" : "'name1@domain1.com, [name2@domain.com](mailto:name2@domain.com)'"

or

"to" : "['name1@domain1.com', 'name2@domain1.com']",

Am I doing anything wrong?

Thanks

---

<div class="post-metadata">

### Author: ![uboness](https://avatars.discourse-cdn.com/v4/letter/u/96bed5/32.png) [@uboness](https://discuss.elastic.co/u/uboness)
#### Post date: [June 26, 2015, 6:33pm UTC](https://discuss.elastic.co/t/email-action-addressexception-illegal-address-when-sending-to-address-list/24452/2 "2015-06-26T18:33:50Z")

</div>

can you show the error you're getting?

---

<div class="post-metadata">

### Author: ![uboness](https://avatars.discourse-cdn.com/v4/letter/u/96bed5/32.png) [@uboness](https://discuss.elastic.co/u/uboness)
#### Post date: [June 26, 2015, 6:34pm UTC](https://discuss.elastic.co/t/email-action-addressexception-illegal-address-when-sending-to-address-list/24452/3 "2015-06-26T18:34:18Z")

</div>

oh... your array in enclosed in quotes... remove the quotes

---

<div class="post-metadata">

### Author: ![cciaccio](https://avatars.discourse-cdn.com/v4/letter/c/ccd318/32.png) [@cciaccio](https://discuss.elastic.co/u/cciaccio)
#### Post date: [June 26, 2015, 6:58pm UTC](https://discuss.elastic.co/t/email-action-addressexception-illegal-address-when-sending-to-address-list/24452/4 "2015-06-26T18:58:31Z")

</div>

if I remove the quotes I get a JsonParseException when I try to load the watch:

curl -XPUT [http://localhost:9200/\_watcher/watch/my\_watch](http://localhost:9200/_watcher/watch/my_watch) -d@watches/my\_watch\_1.json

{"error":"RemoteTransportException[[master\_node][inet[/172.17.0.15:9300]][cluster:admin/watcher/watch/put]]; nested: WatcherException[failed to put watch [my\_watch]]; nested: WatcherException[could not parse watch [my\_watch]]; nested: JsonParseException[Unexpected character (''' (code 39)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: UNKNOWN; line: 1, column: 549]]; ","status":500}

This is my watch:

{  
"trigger" : {  
"schedule" : { "interval" : "30s" }  
},  
"input" : {  
"http" : {  
"request" : {  
"host" : "myclusterIP",  
"port" : 9200,  
"path" : "/cds\_integration-\*/\_search",  
"body" : "{ "query" : { "filtered" : { "query" : {"match" : {"log\_level": "ERROR"}}, "filter" : { "range" : {"@timestamp" : {"gte" : "now-1d"}} } } } }"  
}  
}  
},  
"condition" : {  
"compare" : { "ctx.payload.hits.total" : { "gt" : 0 }}  
},  
"actions" : {  
"alert" : {  
"email" : {  
"to" : ['myfirst.mylast@mmodal.com', 'myfirst.mylast@gmail.com'],  
"subject" : "Watcher test",  
"body" : "Automatic message from Watcher\n\nFound ERRORS in today's cds\_integration logs!"  
}  
}  
}  
}

---

<div class="post-metadata">

### Author: ![cciaccio](https://avatars.discourse-cdn.com/v4/letter/c/ccd318/32.png) [@cciaccio](https://discuss.elastic.co/u/cciaccio)
#### Post date: [June 26, 2015, 7:13pm UTC](https://discuss.elastic.co/t/email-action-addressexception-illegal-address-when-sending-to-address-list/24452/5 "2015-06-26T19:13:47Z")

</div>

Solved my problem. I replaced the single quotes with double quotes inside the array:

from:

"to" : ['myfirst.mylast@mmodal.com', 'myfirst.mylast@gmail.com'],

to:

"to" : ["myfirst.mylast@mmodal.com", "myfirst.mylast@gmail.com"],

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: [July 6, 2017, 1:49pm UTC](https://discuss.elastic.co/t/email-action-addressexception-illegal-address-when-sending-to-address-list/24452/6 "2017-07-06T13:49:23Z")

</div>


