# SMTP Error - Emailing from Watcher Service

**URL:** <https://discuss.elastic.co/t/smtp-error-emailing-from-watcher-service/174354>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [March 28, 2019, 2:24pm UTC](https://discuss.elastic.co/t/smtp-error-emailing-from-watcher-service/174354 "2019-03-28T14:24:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jreuth200](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@jreuth200](https://discuss.elastic.co/u/jreuth200)\
**Post date:** [March 28, 2019, 2:24pm UTC](https://discuss.elastic.co/t/smtp-error-emailing-from-watcher-service/174354/1 "2019-03-28T14:24:48Z")

</div>

When attempting to send emails using the watcher service, an SMTP error is generated saying that the Client was not authenticated to send anonymous mail and fails. I am trying to send email from our relay service with no SSL or any authentication.

Stack Trace:

> [2019-03-27T20:52:43,572][INFO][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [sptesingst-wc-01] publish\_address {Redacted IP}, bound\_addresses {Redacted IP}  
> [2019-03-27T20:52:43,572][INFO][o.e.n.Node] [Redacted Host Name] started  
> [2019-03-27T20:53:22,013][ERROR][o.e.x.w.a.e.ExecutableEmailAction] [Redacted Host Name] failed to execute action [_inlined_/email\_1]  
> javax.mail.MessagingException: failed to send email with subject [Watch [test] has exceeded the threshold] via account [outlook\_account]  
> at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:154) ~[?:?]  
> at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:146) ~[?:?]  
> at org.elasticsearch.xpack.watcher.actions.email.ExecutableEmailAction.execute(ExecutableEmailAction.java:72) ~[?:?]  
> at org.elasticsearch.xpack.core.watcher.actions.ActionWrapper.execute(ActionWrapper.java:144) [x-pack-core-6.5.4.jar:6.5.4]  
> at org.elasticsearch.xpack.watcher.execution.ExecutionService.executeInner(ExecutionService.java:455) [x-pack-watcher-6.5.4.jar:6.5.4]  
> at org.elasticsearch.xpack.watcher.execution.ExecutionService.execute(ExecutionService.java:295) [x-pack-watcher-6.5.4.jar:6.5.4]  
> at org.elasticsearch.xpack.watcher.transport.actions.execute.TransportExecuteWatchAction$1.doRun(TransportExecuteWatchAction.java:154) [x-pack-watcher-6.5.4.jar:6.5.4]  
> at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.5.4.jar:6.5.4]  
> at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0\_121]  
> at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0\_121]  
> at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:624) [elasticsearch-6.5.4.jar:6.5.4]  
> at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0\_121]  
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0\_121]  
> at java.lang.Thread.run(Unknown Source) [?:1.8.0\_121]  
> Caused by: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM
> 
> ```
> at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2358) ~[?:?]
> at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1823) ~[?:?]
> at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1300) ~[?:?]
> at org.elasticsearch.xpack.watcher.notification.email.Account.send(Account.java:141) ~[?:?]
> at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:152) ~[?:?]
> ... 13 more
> 
> ```

Configuration (elasticsearch.yml):

> xpack.notification.email:  
> default\_account: outlook\_account  
> account:  
> outlook\_account:  
> profile: outlook  
> smtp:  
> auth: false  
> ssl.trust: "\*"  
> starttls.enable: false  
> host: [Redacted Relay]  
> port: 587  
> user: [Redacted User Name]  
> email\_defaults:  
> from: [Redacted Email]

---

<div class="post-metadata">

**Author:** ![jreuth200](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@jreuth200](https://discuss.elastic.co/u/jreuth200)\
**Post date:** [March 29, 2019, 2:00pm UTC](https://discuss.elastic.co/t/smtp-error-emailing-from-watcher-service/174354/2 "2019-03-29T14:00:02Z")

</div>

Hi team, are there any updates to this request?

---

<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:** [April 1, 2019, 7:19am UTC](https://discuss.elastic.co/t/smtp-error-emailing-from-watcher-service/174354/3 "2019-04-01T07:19:24Z")

</div>

the important message is this one:

> [@jreuth200](#):
>
> Client was not authenticated to send anonymous mail during MAIL FROM

This means, that your authentication data was not allowing you to send emails.

Can you provide a gist/pastebin of your YAML configuration, maybe this is just an indentation issue. It is hard to tell due to the YAML not being formatted properly.

Thanks!

---

<div class="post-metadata">

**Author:** ![jreuth200](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@jreuth200](https://discuss.elastic.co/u/jreuth200)\
**Post date:** [April 1, 2019, 5:44pm UTC](https://discuss.elastic.co/t/smtp-error-emailing-from-watcher-service/174354/4 "2019-04-01T17:44:36Z")

</div>

Hello,

Thank you for your reply. Please see this pastebin for the xpack configuration in our elasticsearch.yml file: [https://pastebin.com/vb0mN1d1](https://pastebin.com/vb0mN1d1)

Thank you,

Jared

---

<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:** [April 2, 2019, 10:41am UTC](https://discuss.elastic.co/t/smtp-error-emailing-from-watcher-service/174354/5 "2019-04-02T10:41:31Z")

</div>

how did you set your SMTP user password? Can you paste the full command if set via the keystore command?

---

<div class="post-metadata">

**Author:** ![jreuth200](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@jreuth200](https://discuss.elastic.co/u/jreuth200)\
**Post date:** [April 5, 2019, 3:10pm UTC](https://discuss.elastic.co/t/smtp-error-emailing-from-watcher-service/174354/6 "2019-04-05T15:10:30Z")

</div>

Hello,

No SMTP user password was set as we are trying to send email notifications with no authentication.

---

<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:** [April 9, 2019, 11:18am UTC](https://discuss.elastic.co/t/smtp-error-emailing-from-watcher-service/174354/7 "2019-04-09T11:18:45Z")

</div>

Hey,

you need to make sure there is neither a user, nor a password nor a auth configuration in your user account config. See this example:

```auto
PUT /_cluster/settings
{
    "transient" : {
        "xpack.notification.email.account.my_account.smtp" : {
          "host": "localhost",
          "port": 1025
        }
    }
}

POST _xpack/watcher/watch/_execute
{
  "watch": {
    "trigger": {
      "schedule": {
        "interval": "10h"
      }
    },
    "input": {
      "simple": {
        "foo": "bar"
      }
    },
    "actions": {
      "send_email": {
        "email": {
          "to": "foo@example.org",
          "subject": "Watcher Notification",
          "body": "PAYLOAD {{ctx.payload}}"
        }
      },
      "logme": {
        "logging": {
          "text": "{{ctx}}"
        }
      }
    }
  }
}

```

hope this helps!

---

<div class="post-metadata">

**Author:** ![jreuth200](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@jreuth200](https://discuss.elastic.co/u/jreuth200)\
**Post date:** [April 9, 2019, 9:14pm UTC](https://discuss.elastic.co/t/smtp-error-emailing-from-watcher-service/174354/8 "2019-04-09T21:14:14Z")

</div>

Hey Spin,

I performed the steps you suggested and restarted the elasticsearch service, however we are still seeing errors:

[2019-04-09T21:12:36,681][INFO][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [sptesingst-wc-01] publish\_address {10.124.5.90:9200}, bound\_addresses {10.124.5.90:9200}  
[2019-04-09T21:12:36,681][INFO][o.e.n.Node] [sptesingst-wc-01] started  
[2019-04-09T21:13:04,220][ERROR][o.e.x.w.a.e.ExecutableEmailAction] [sptesingst-wc-01] failed to execute action [_inlined_/email\_1]  
javax.mail.MessagingException: failed to send email with subject [Watch [bat] has exceeded the threshold] via account [outlook\_account]  
at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:154) ~[?:?]  
at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:146) ~[?:?]  
at org.elasticsearch.xpack.watcher.actions.email.ExecutableEmailAction.execute(ExecutableEmailAction.java:72) ~[?:?]  
at org.elasticsearch.xpack.core.watcher.actions.ActionWrapper.execute(ActionWrapper.java:144) [x-pack-core-6.5.4.jar:6.5.4]  
at org.elasticsearch.xpack.watcher.execution.ExecutionService.executeInner(ExecutionService.java:455) [x-pack-watcher-6.5.4.jar:6.5.4]  
at org.elasticsearch.xpack.watcher.execution.ExecutionService.execute(ExecutionService.java:295) [x-pack-watcher-6.5.4.jar:6.5.4]  
at org.elasticsearch.xpack.watcher.transport.actions.execute.TransportExecuteWatchAction$1.doRun(TransportExecuteWatchAction.java:154) [x-pack-watcher-6.5.4.jar:6.5.4]  
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.5.4.jar:6.5.4]  
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0\_121]  
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0\_121]  
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:624) [elasticsearch-6.5.4.jar:6.5.4]  
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0\_121]  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0\_121]  
at java.lang.Thread.run(Unknown Source) [?:1.8.0\_121]  
Caused by: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM

```
    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2358) ~[?:?]
    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1823) ~[?:?]
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1300) ~[?:?]
    at org.elasticsearch.xpack.watcher.notification.email.Account.send(Account.java:141) ~[?:?]
    at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:152) ~[?:?]

```

Thanks,

Jared

---

<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:** [April 11, 2019, 1:26pm UTC](https://discuss.elastic.co/t/smtp-error-emailing-from-watcher-service/174354/9 "2019-04-11T13:26:58Z")

</div>

hey,

have you explicitely removed the other options from the YAML file or set them to `null`, if you are using the cluser update settings API? Otherwise those settings might still be set.

--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:** [May 9, 2019, 1:27pm UTC](https://discuss.elastic.co/t/smtp-error-emailing-from-watcher-service/174354/10 "2019-05-09T13:27:00Z")

</div>

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