# Ignore unconfirmed accounts when sending mails in elastic watchers

**URL:** <https://discuss.elastic.co/t/ignore-unconfirmed-accounts-when-sending-mails-in-elastic-watchers/97765>\
**Category:** Elasticsearch\
**Created:** [August 21, 2017, 12:37pm UTC](https://discuss.elastic.co/t/ignore-unconfirmed-accounts-when-sending-mails-in-elastic-watchers/97765 "2017-08-21T12:37:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dinaWork](https://avatars.discourse-cdn.com/v4/letter/d/edb3f5/32.png) [@dinaWork](https://discuss.elastic.co/u/dinaWork)\
**Post date:** [August 21, 2017, 12:37pm UTC](https://discuss.elastic.co/t/ignore-unconfirmed-accounts-when-sending-mails-in-elastic-watchers/97765/1 "2017-08-21T12:37:28Z")

</div>

I am using elastic search watcher, and send notifications via email.  
I have requested whitelisting for all workers in my company.  
I confirmed my own email (can't confirm for other people.

here is my action:

```auto
  "actions" : {
    "email_administrator" : {
      "email" : {
        "to" : ["bob@gmail.com", "jim@gmail.com", "jay@gmail.com"],
        "subject" : "errors and warnings in last 24 hours",
        "body" : "hi",
        "priority" : "high"
      }
    }
  }

```

but i do not receive any email  
when i get the watcher status  
`curl -XPOST 'https://myelatic.us-east-1.aws.found.io:9243/.watches/_search?pretty' -H 'Content-Type: application/json' -d'{"size" : 100}'`

I get:

```auto
 "last_execution" : {
         "reason" : "MessagingException[failed to send email with subject [errors and warnings in last 24 hours] via account [work]]; nested: SendFailedException[Invalid Addresses]; nested: SMTPAddressFailedException[554 5.7.1 <bob@gmail.com>: Recipient address rejected: Access denied\n]; ",
         "timestamp" : "2017-08-21T12:10:17.869Z",
          "successful" : false
 }

```

since bob hasn't confirmed his email,  
so when I remove bob from the list, it works well and I receive an email,

my question is: how can I make it send emails to all accounts which are confirmed, and ignore unconfirmed accounts, since I cannot force confirmations of accounts

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [September 7, 2017, 6:03am UTC](https://discuss.elastic.co/t/ignore-unconfirmed-accounts-when-sending-mails-in-elastic-watchers/97765/2 "2017-09-07T06:03:03Z")

</div>

This is not possible. Elasticsearch can not know if an e-mail account is confirmed or not because it sends e-mail messages using standard SMTP protocol, which does not exposes such information.

---

<div class="post-metadata">

**Author:** ![dinaWork](https://avatars.discourse-cdn.com/v4/letter/d/edb3f5/32.png) [@dinaWork](https://discuss.elastic.co/u/dinaWork)\
**Post date:** [September 7, 2017, 6:17am UTC](https://discuss.elastic.co/t/ignore-unconfirmed-accounts-when-sending-mails-in-elastic-watchers/97765/3 "2017-09-07T06:17:15Z")

</div>

> Elasticsearch can not know if an e-mail account is confirmed or not

ok,

but my point is that if **one** email is not confirmed - elastic watcher will fail sending to **all** recipients , also **confirmed** emails,  
why?

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [September 7, 2017, 6:31am UTC](https://discuss.elastic.co/t/ignore-unconfirmed-accounts-when-sending-mails-in-elastic-watchers/97765/4 "2017-09-07T06:31:26Z")

</div>

This is not watcher's fault and it depends on the SMTP server itself. Watcher will send a single e-mail with all recipients separated by `;` to the SMTP server. How the SMTP server will handle a failing e-mail address, is up to it.

One workaround is using more than one e-mail action. One per e-mail address.

---

<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:** [October 5, 2017, 6:31am UTC](https://discuss.elastic.co/t/ignore-unconfirmed-accounts-when-sending-mails-in-elastic-watchers/97765/5 "2017-10-05T06:31:32Z")

</div>

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