# Watcher is not sending email in ES 5.2

**URL:** https://discuss.elastic.co/t/watcher-is-not-sending-email-in-es-5-2/89482
**Category:** Elasticsearch
**Tags:** elastic-stack-alerting
**Created:** [June 15, 2017, 1:28am UTC](https://discuss.elastic.co/t/watcher-is-not-sending-email-in-es-5-2/89482 "2017-06-15T01:28:27Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ankush\_singh](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@ankush\_singh](https://discuss.elastic.co/u/ankush_singh)
#### Post date: [June 15, 2017, 1:28am UTC](https://discuss.elastic.co/t/watcher-is-not-sending-email-in-es-5-2/89482/1 "2017-06-15T01:28:28Z")

</div>

Hi,  
i am **using ES 5.2**

i am trying to implement watcher for some keywords ("filename" : getSSLConnectionSocketFactory.java") I used below curl but its not working out.  
Can someone tell me what wrong I am doing or please share your YML.

--

curl -XPUT 'localhost:9200/\_xpack/watcher/watch/bad\_watch?pretty' -H 'Content-Type: application/json' -d'  
{  
"trigger" : {  
"schedule" : { "cron" : "0 0/1 \* \* \* ?" }  
},  
"input" : {  
"search" : {  
"request" : {  
"indices" : [  
"logstash\*"  
],  
"body" : {  
"query" : {  
"bool" : {  
"must" : {  
"match": {  
"methodName":"getSSLConnectionSocketFactory"  
}  
},  
"filter" : {  
"range": {  
"@timestamp": {  
"from": "{{ctx.trigger.scheduled\_time}}||-5m",  
"to": "{{ctx.trigger.triggered\_time}}"  
}  
}  
}  
}  
}  
}  
}  
}  
},  
"condition" : {  
"compare" : { "ctx.payload.hits.total" : { "gt" : 0 }}  
},  
"actions" : {  
"email\_admin" : {  
"email" : {  
"to" : "xxxx.xx@gmail.com",  
"subject" : "404 recently encountered"  
}  
}  
}  
}  
'

while doing curl to check status of watchers..  
curl -XGET localhost:9200/\_xpack/watcher/watch/bad\_watch  
It gives me below error --

"successful":false,"reason":"IllegalArgumentException[no account found for name: [null]]"}}}}

---

<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 15, 2017, 3:31pm UTC](https://discuss.elastic.co/t/watcher-is-not-sending-email-in-es-5-2/89482/2 "2017-06-15T15:31:05Z")

</div>

Hey,

can you share your cluster state, so we can see how your email accounts are configured?

--Alex

---

<div class="post-metadata">

### Author: ![ankush\_singh](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@ankush\_singh](https://discuss.elastic.co/u/ankush_singh)
#### Post date: [June 15, 2017, 5:44pm UTC](https://discuss.elastic.co/t/watcher-is-not-sending-email-in-es-5-2/89482/3 "2017-06-15T17:44:43Z")

</div>

please let me know if you need any other detail.I am using deb image for my docker.  
My elastic search yml file is as below -

[cluster.name](http://cluster.name): elasticsearch-logging

[node.name](http://node.name): "elasticsearch-logging-0"

path.data: /var/lib/elasticsearch/data

xpack.notification.email.account:  
gmail\_account:  
profile: gmail  
smtp:  
auth: true  
starttls.enable: true  
host: [smtp.gmail.com](http://smtp.gmail.com)  
port: 587  
user: \*\*\*\ ***.** @gmail.com  
password: \*\*\*\*\*\*

---

<div class="post-metadata">

### Author: ![ankush\_singh](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@ankush\_singh](https://discuss.elastic.co/u/ankush_singh)
#### Post date: [June 15, 2017, 9:06pm UTC](https://discuss.elastic.co/t/watcher-is-not-sending-email-in-es-5-2/89482/4 "2017-06-15T21:06:25Z")

</div>

I think I have resolved previous issues.

But a strange issues I am Facing now. Google is blocking verification of email and I am getting below log for watcher --

DOING CURL --  
curl -XGET localhost:9200/\_xpack/watcher/watch/last\_watch

Getting below response:

{"found":true,"\_id":"last\_watch","\_status":{"version":5,"state":{"active":true,"timestamp":"2017-06-16T00:39:16.654Z"},"last\_checked":"2017-06-16T00:43:00.229Z","last\_met\_condition":"2017-06-16T00:43:00.229Z","actions":{"email\_admin":{"ack":{"timestamp":"2017-06-16T00:39:16.654Z","state":"awaits\_successful\_execution"},"last\_execution":{"timestamp":"2017-06-16T00:43:00.229Z","successful":false,"reason":"MessagingException[failed to send email with subject [404 recently encountered] via account [gmail\_account]]; nested: AuthenticationFailedException[534-5.7.14 \<[https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbvF\n534-5.7.14](https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbvF%5Cn534-5.7.14) q0WEdpll7GFx7wL5ZoIKlaHy0J1Z58ZNsgsuseIWKkJEAaiNf5hWY11ZPPsJb6u7h9z0Xe\n534-5.7.14 kWiT264a1EJgbKW5ESeccxI0uUZ\_3X4klQS4jBjB7dDw6pRU490p-yKtXkL2-Ik\n534-5.7.14 vMoQFBgYsmH2WbbGFC3Z63GBpWVH0O9LmpVsB89ZsSreIXN\_bb0AX3UWwoX4dTb4UiXtmi\n534-5.7.14 ExF49I6J7QFe3yZLjP98FnMpJtkQI\> Please log in via your web browser and\n534-5.7.14 then try again.\n534-5.7.14 Learn more at\n534 5.7.14 [https://support.google.com/mail/answer/78754](https://support.google.com/mail/answer/78754) a22sm752699pfc.115 - gsmtp\n]; "}}}},"watch":{"trigger":{"schedule":{"cron":"0 0/1 \* \* \* ?"}},"input":{"search":{"request":{"search\_type":"query\_then\_fetch","indices":["logstash\*"],"types":[],"body":{"query":{"bool":{"must":{"match":{"methodName":"getSSLConnectionSocketFactory"}}}}}}}},"condition":{"compare":{"ctx.payload.hits.total":{"gt":0}}},"actions":{"email\_admin":{"email":{"profile":"standard","to":["ankushsingh.gre@gmail.com"],"subject":"404 recently encountered"}}}}}r

---

<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 16, 2017, 6:13am UTC](https://discuss.elastic.co/t/watcher-is-not-sending-email-in-es-5-2/89482/5 "2017-06-16T06:13:48Z")

</div>

Hey,

please keep in mind, that this forum does not come with any SLA guarantees. If you need those, use our official support.

If you are using gmail with two factor auth enabled, you have to create a so called unique password, there is a link in our documentation pointing to the corresponding gmail documentation. As you can see in the output, also google points to a link to debug this issue further in its output.

--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 14, 2017, 6:13am UTC](https://discuss.elastic.co/t/watcher-is-not-sending-email-in-es-5-2/89482/6 "2017-07-14T06:13:53Z")

</div>

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