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

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'"

or

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

Am I doing anything wrong?

Thanks

can you show the error you're getting?

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

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 -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!"
}
}
}
}

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

3 Likes