# Unable to send alert with watcher email configuration

**URL:** https://discuss.elastic.co/t/unable-to-send-alert-with-watcher-email-configuration/62251
**Category:** Elasticsearch
**Tags:** elastic-stack-alerting
**Created:** [October 5, 2016, 9:44am UTC](https://discuss.elastic.co/t/unable-to-send-alert-with-watcher-email-configuration/62251 "2016-10-05T09:44:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sahilarora0928](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@sahilarora0928](https://discuss.elastic.co/u/sahilarora0928)
#### Post date: [October 5, 2016, 9:44am UTC](https://discuss.elastic.co/t/unable-to-send-alert-with-watcher-email-configuration/62251/1 "2016-10-05T09:44:41Z")

</div>

Hi,  
I am getting following exception when trying to send a gmail message as alert:

.]).  
**[2016-10-05 15:10:06,845][ERROR][watcher.actions.email] [Aries] failed to execute action [event\_critical\_watch/email\_admin]**  
**javax.mail.MessagingException: failed to send email with subject [event\_critical\_watch executed] via account [gmail];**  
\*\* nested exception is:\*\*  
\*\* com.sun.mail.util.MailConnectException: Couldn't connect to host, port: [smtp.gmail.com](http://smtp.gmail.com), 587; timeout 120000;\*\*  
\*\* nested exception is:\*\*  
\*\* java.net.ConnectException: Connection refused: connect\*\*  
\*\* at org.elasticsearch.watcher.actions.email.service.InternalEmailService.send(InternalEmailService.java:85)\*\*  
\*\* at org.elasticsearch.watcher.actions.email.service.InternalEmailService.send(InternalEmailService.java:77)\*\*  
\*\* at org.elasticsearch.watcher.actions.email.ExecutableEmailAction.execute(ExecutableEmailAction.java:84)\*\*  
\*\* at org.elasticsearch.watcher.actions.ActionWrapper.execute(ActionWrapper.java:106)\*\*  
\*\* at org.elasticsearch.watcher.execution.ExecutionService.executeInner(ExecutionService.java:388)\*\*  
\*\* at org.elasticsearch.watcher.execution.ExecutionService.execute(ExecutionService.java:273)\*\*  
\*\* at org.elasticsearch.watcher.execution.ExecutionService$WatchExecutionTask.run(ExecutionService.java:438)\*\*  
\*\* at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\*\*  
\*\* at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\*\*  
\*\* at java.lang.Thread.run(Thread.java:745)\*\*  
**Caused by: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: [smtp.gmail.com](http://smtp.gmail.com), 587; timeout 120000;**  
\*\* nested exception is:\*\*  
\*\* java.net.ConnectException: Connection refused: connect\*\*  
\*\* at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2054)\*\*  
\*\* at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:697)\*\*  
\*\* at javax.mail.Service.connect(Service.java:364)\*\*  
\*\* at org.elasticsearch.watcher.actions.email.service.Account.send(Account.java:124)\*\*  
\*\* at org.elasticsearch.watcher.actions.email.service.InternalEmailService.send(InternalEmailService.java:83)\*\*  
\*\* ... 9 more\*\*  
**Caused by: java.net.ConnectException: Connection refused: connect**  
\*\* at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)\*\*  
\*\* at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)\*\*  
\*\* at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)\*\*  
\*\* at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)\*\*  
\*\* at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)\*\*  
\*\* at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)\*\*  
\*\* at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)\*\*  
\*\* at java.net.Socket.connect(Socket.java:579)\*\*  
\*\* at com.sun.mail.util.WriteTimeoutSocket.connect(WriteTimeoutSocket.java:112)\*\*  
\*\* at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:327)\*\*  
\*\* at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:236)\*\*  
\*\* at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2020)\*\*  
\*\* ... 13 more\*\*  
**[2016-10-05 15:10:06,990][INFO][cluster.metadata] [Aries] [.watch\_history-2016.10.05] creating index, cause [auto(index api)], templates [watch\_history], shards [1]/**  
**[1], mappings [watch\_record]**  
**[2016-10-05 15:10:07,167][INFO][cluster.routing.allocation] [Aries] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[.watch\_history-2016.10.05]**  
**[0]] ...]).**  
**[2016-10-05 15:10:07,226][INFO][cluster.metadata] [Aries] [.watch\_history-2016.10.05] update\_mapping [watch\_record]**

I have added following lines in elasticsearch.yml file .

watcher.actions.email.service.account:  
gmail:  
profile: gmail  
smtp:  
auth: true  
starttls.enable: true  
host: [smtp.gmail.com](http://smtp.gmail.com)  
port: 587  
user: **@gmail.com  
password: a**\*\*\*

Please help me to solve this.

---

<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: [October 5, 2016, 10:03am UTC](https://discuss.elastic.co/t/unable-to-send-alert-with-watcher-email-configuration/62251/2 "2016-10-05T10:03:11Z")

</div>

Hey,

I already answered in a [previous thread](https://discuss.elastic.co/t/failed-to-start-watcher-please-wait-for-the-cluster-to-become-ready-or-try-to-start-watcher-manully/61669/7), or to be more exact, right [here](https://discuss.elastic.co/t/failed-to-start-watcher-please-wait-for-the-cluster-to-become-ready-or-try-to-start-watcher-manully/61669/6?u=spinscale). Please be kind and either provide more specific information or dont open new threads without any new information.

--Alex

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [October 5, 2016, 10:15am UTC](https://discuss.elastic.co/t/unable-to-send-alert-with-watcher-email-configuration/62251/3 "2016-10-05T10:15:33Z")

</div>


