# Watcher failing to send emails

**URL:** https://discuss.elastic.co/t/watcher-failing-to-send-emails/62141
**Category:** Elasticsearch
**Tags:** elastic-stack-alerting
**Created:** [October 4, 2016, 10:32am UTC](https://discuss.elastic.co/t/watcher-failing-to-send-emails/62141 "2016-10-04T10:32:58Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![mtarimo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mtarimo/32/12282_2.png) [@mtarimo](https://discuss.elastic.co/u/mtarimo)
#### Post date: [October 4, 2016, 10:32am UTC](https://discuss.elastic.co/t/watcher-failing-to-send-emails/62141/1 "2016-10-04T10:32:58Z")

</div>

Hi,

I am using elastic cloud.  
I have just created a script and I am getting this error;

MessagingException[failed to send email with subject [Daily MNO Snapshot] via account [work]]; nested: SendFailedException[Invalid Addresses]; nested: SMTPAddressFailedException[554 5.7.1 [mtarimo@aimgroup.co.tz](mailto:mtarimo@aimgroup.co.tz): Recipient address rejected: Access denied\n];

Below is my configuration;

PUT \_watcher/watch/report\_mno\_mngt  
{  
"trigger": {  
"schedule": {  
"interval": "1d"  
}  
},  
"actions": {  
"work": {  
"email": {  
"to": "'micahel tarimo [mtarimo@aimgroup.co.tz](mailto:mtarimo@aimgroup.co.tz)'",  
"subject": "Daily MNO Snapshot",  
"body": "Please find attached the snapshot for today",  
"attachments": {  
"mno\_report\_mngt.pdf": {  
"http": {  
"content\_type": "application/pdf",  
"request": {  
"method": "POST",  
"headers": {  
"kbn-xsrf": "reporting"  
},  
"auth": {  
"basic": {  
"username": "theuser",  
"password": "dfdfdfd"  
}  
},  
"read\_timeout": "300s",  
"url": "[https://3463d22a13e96ssa5524567e1c30c2b5cd.tz-west-7.aws.found.io/api/reporting/generate/dashboard/MNO-Dashboard?\_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-15m,mode:quick,to:now)](https://3463d22a13e96ssa5524567e1c30c2b5cd.tz-west-7.aws.found.io/api/reporting/generate/dashboard/MNO-Dashboard?_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-15m,mode:quick,to:now)))&\_a=(filters:!(),options:(darkTheme:!f),panels:!((col:1,id:mno\_performance,panelIndex:4,row:1,size\_x:6,size\_y:4,type:visualization),(col:7,id:mno\_gender,panelIndex:5,row:1,size\_x:3,size\_y:2,type:visualization),(col:10,id:mno\_idtypes,panelIndex:6,row:1,size\_x:3,size\_y:2,type:visualization),(col:7,id:mno\_quality\_check,panelIndex:7,row:3,size\_x:3,size\_y:2,type:visualization),(col:10,id:mno\_region\_registrations\_pie,panelIndex:8,row:3,size\_x:3,size\_y:2,type:visualization),(col:1,id:mno\_region\_registrations\_line,panelIndex:9,row:5,size\_x:12,size\_y:3,type:visualization)),query:(query\_string:(analyze\_wildcard:!t,query:%27\*%27)),title:%MNO%20Dashboard%27,uiState:(P-5:(vis:(legendOpen:!f)),P-7:(vis:(legendOpen:!f))))&sync"  
}  
}  
}  
}  
}  
}  
}  
}

I have followed the steps to whitelist the email addresses.

Is there anything I am doing wrong?

Thanks,  
Michael

---

<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 4, 2016, 11:51am UTC](https://discuss.elastic.co/t/watcher-failing-to-send-emails/62141/2 "2016-10-04T11:51:37Z")

</div>

Hey,

this looks like an invalid email address. Can you try either only the email addr like `mtarimo@aimgroup...` or use proper marking of the name like `Michael Tarimo <foo@bar.org>`.. see the [docs](https://www.elastic.co/guide/en/x-pack/5.0/actions-email.html#email-address) for examples

--Alex

---

<div class="post-metadata">

### Author: ![mtarimo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mtarimo/32/12282_2.png) [@mtarimo](https://discuss.elastic.co/u/mtarimo)
#### Post date: [October 4, 2016, 12:26pm UTC](https://discuss.elastic.co/t/watcher-failing-to-send-emails/62141/3 "2016-10-04T12:26:51Z")

</div>

Hi Alex,

Thanks for your response.

I have tried these options;

"email": {  
"to": "'Micahel Tarimo [mtarimo@aimgroup.co.tz](mailto:mtarimo@aimgroup.co.tz)'",  
"subject": "Daily MNO Snapshot",

"email": {  
"to": "Micahel Tarimo [mtarimo@aimgroup.co.tz](mailto:mtarimo@aimgroup.co.tz)",  
"subject": "Daily MNO Snapshot",

"email": {  
"to": "'Micahel Tarimo [mtarimo@aimgroup.co.tz](mailto:mtarimo@aimgroup.co.tz)'",  
"subject": "Daily MNO Snapshot",

"email": {  
"to": "'mtarimo@aimgroup.co.tz'",  
"subject": "Daily MNO Snapshot",

"email": {  
"to": "mtarimo@aimgroup.co.tz",  
"subject": "Daily MNO Snapshot",

Unfortunately, they all fail!

Could you please help me fill in what needs to go into the "to" field?  
The email is [mtarimo@aimgroup.co.tz](mailto:mtarimo@aimgroup.co.tz), the name is Michael Tarimo.  
I have also whitelisted [michael.tarimo@gmail.com](mailto:michael.tarimo@gmail.com)

Thanks,  
Michael

---

<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:00am UTC](https://discuss.elastic.co/t/watcher-failing-to-send-emails/62141/4 "2016-10-05T10:00:22Z")

</div>

Hey,

some of them contain a wrong email address, where as others contain correct ones. Either check the watcher history indices or use the [execute watch API](https://www.elastic.co/guide/en/watcher/2.4/api-rest.html#api-rest-execute-watch) and paste the output here. Both will contain all the information what went wrong - maybe your watch execution failed somewhere else.

--Alex

---

<div class="post-metadata">

### Author: ![mtarimo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mtarimo/32/12282_2.png) [@mtarimo](https://discuss.elastic.co/u/mtarimo)
#### Post date: [October 5, 2016, 1:54pm UTC](https://discuss.elastic.co/t/watcher-failing-to-send-emails/62141/5 "2016-10-05T13:54:14Z")

</div>

The execution only fails on the sending email part.  
Below is the output.

{  
"\_id": "report\_mno\_mngt\_0-2016-10-05T13:48:08.087Z",  
"watch\_record": {  
"watch\_id": "report\_mno\_mngt",  
"state": "executed",  
"trigger\_event": {  
"type": "manual",  
"triggered\_time": "2016-10-05T13:48:08.087Z",  
"manual": {  
"schedule": {  
"scheduled\_time": "2016-10-05T13:48:08.087Z"  
}  
}  
},  
"input": {  
"none": {}  
},  
"condition": {  
"always": {}  
},  
"messages": [],  
"result": {  
"execution\_time": "2016-10-05T13:48:08.087Z",  
"execution\_duration": 52304,  
"input": {  
"type": "none",  
"status": "success",  
"payload": {}  
},  
"condition": {  
"type": "always",  
"status": "success",  
"met": true  
},  
"actions": [  
{  
"id": "work",  
"type": "email",  
"status": "failure",  
"reason": "MessagingException[failed to send email with subject [Daily MNO Snapshot] via account [work]]; nested: SendFailedException[Invalid Addresses]; nested: SMTPAddressFailedException[554 5.7.1 [mtarimo@aimgroup.co.tz](mailto:mtarimo@aimgroup.co.tz): Recipient address rejected: Access denied\n]; "  
}  
]  
}  
}  
}

---

<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, 2:08pm UTC](https://discuss.elastic.co/t/watcher-failing-to-send-emails/62141/6 "2016-10-05T14:08:59Z")

</div>

Hey,

this is not a watcher error, but a misconfiguration of your mailserver, which rejects that incoming email. Or you may be missing credentials in your watcher configuration to be allowed to send email. The important part is

```auto
554 5.7.1 mtarimo@aimgroup.co.tz: Recipient address rejected: Access denied

```

which is a direct reply from your mail server.

--Alex

---

<div class="post-metadata">

### Author: ![mtarimo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mtarimo/32/12282_2.png) [@mtarimo](https://discuss.elastic.co/u/mtarimo)
#### Post date: [October 5, 2016, 2:17pm UTC](https://discuss.elastic.co/t/watcher-failing-to-send-emails/62141/7 "2016-10-05T14:17:27Z")

</div>

Hi Alex,

I am using the elastic cloud service. I have no access to the watcher configurations.  
I have followed the steps to allow watcher to send out emails, which is to "whitelist" the emails from the elastic cloud console. I received the watcher whitelist request, which i accepted.  
From the receiving part, we are using google email service.

Thanks,  
Michael

---

<div class="post-metadata">

### Author: ![mtarimo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mtarimo/32/12282_2.png) [@mtarimo](https://discuss.elastic.co/u/mtarimo)
#### Post date: [October 5, 2016, 2:23pm UTC](https://discuss.elastic.co/t/watcher-failing-to-send-emails/62141/8 "2016-10-05T14:23:22Z")

</div>

I have seen this post as well, but no luck for me.

[https://discuss.elastic.co/t/watcher-send-email-aand-kibana-version/32445/4?u=mtarimo&source\_topic\_id=62141](https://discuss.elastic.co/t/watcher-send-email-aand-kibana-version/32445/4?u=mtarimo&source_topic_id=62141)

---

<div class="post-metadata">

### Author: ![mtarimo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mtarimo/32/12282_2.png) [@mtarimo](https://discuss.elastic.co/u/mtarimo)
#### Post date: [October 9, 2016, 1:06pm UTC](https://discuss.elastic.co/t/watcher-failing-to-send-emails/62141/9 "2016-10-09T13:06:51Z")

</div>

Hi Alex,

This has been fixed. There was a problem which was preventing watcher from sending emails out.

Thanks.

[https://discuss.elastic.co/t/watcher-send-email-aand-kibana-version/32445/7?u=mtarimo&source\_topic\_id=62141](https://discuss.elastic.co/t/watcher-send-email-aand-kibana-version/32445/7?u=mtarimo&source_topic_id=62141)

---

<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 10, 2016, 8:46am UTC](https://discuss.elastic.co/t/watcher-failing-to-send-emails/62141/10 "2016-10-10T08:46:59Z")

</div>

Awesome, thanks so much for the update, Michael!

--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 6, 2017, 1:42pm UTC](https://discuss.elastic.co/t/watcher-failing-to-send-emails/62141/11 "2017-07-06T13:42:40Z")

</div>


