# SMTP failed exception 500 bad request

**URL:** <https://discuss.elastic.co/t/smtp-failed-exception-500-bad-request/194161>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [August 7, 2019, 6:57am UTC](https://discuss.elastic.co/t/smtp-failed-exception-500-bad-request/194161 "2019-08-07T06:57:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rj23495](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@rj23495](https://discuss.elastic.co/u/rj23495)\
**Post date:** [August 7, 2019, 6:57am UTC](https://discuss.elastic.co/t/smtp-failed-exception-500-bad-request/194161/1 "2019-08-07T06:57:51Z")

</div>

```
xpack.notification.email.account:
   mail1:
    profile: standard
    smtp.host: #####
    smtp.port: 80
    smtp.auth: true
    smtp.starttls.enable: true
    smtp.user: ####
    smtp.password: ####

```

Exception-  
[o.e.x.w.a.e.ExecutableEmailAction] [4SpMsfD] failed to execute action [af66e8af-c288-4b56-be3e-1d149c6018d8/email\_1] javax.mail.MessagingException: failed to send email with subject [Watch [geo\_datasource\_getconnection\_success\_latency] has exceeded the threshold] via account [mail1] 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.7.0.jar:6.7.0] at org.elasticsearch.xpack.watcher.execution.ExecutionService.executeInner(ExecutionService.java:456) [x-pack-watcher-6.7.0.jar:6.7.0] at org.elasticsearch.xpack.watcher.execution.ExecutionService.execute(ExecutionService.java:295) [x-pack-watcher-6.7.0.jar:6.7.0] at org.elasticsearch.xpack.watcher.execution.ExecutionService.lambda$executeAsync$5(ExecutionService.java:396) [x-pack-watcher-6.7.0.jar:6.7.0] at org.elasticsearch.xpack.watcher.execution.ExecutionService$WatchExecutionTask.run(ExecutionService.java:545) [x-pack-watcher-6.7.0.jar:6.7.0] at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:681) [elasticsearch-6.7.0.jar:6.7.0] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at java.lang.Thread.run(Thread.java:834) [?:?] Caused by: com.sun.mail.smtp.SMTPSendFailedException: 500 Bad request (syntax error or unrecognized) [@sm190201] 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) ~[?:?] ... 11 more

Aug 7, 2019, 12:26:07  
172.16.0.111

---

<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:** [August 7, 2019, 7:09am UTC](https://discuss.elastic.co/t/smtp-failed-exception-500-bad-request/194161/2 "2019-08-07T07:09:17Z")

</div>

Hey,

please be so kind to also properly format your exceptions as code, this just makes it so much more readable...

If you look at that exception, there is some piece of information carefully hidden beneath it

> failed to send email with subject [Watch [geo\_datasource\_getconnection\_success\_latency] has exceeded the threshold] via account [mail1]

the important part here is the fact that this is a `MessagingException`, which basically means, that this error was returned from the SMTP server side of things, where the alerting code tried to send the message to. Is the stack trace bigger by any chance and you could it off, maybe there is more information, why the SMTP server on the other side rejected the message.

Maybe you can also check the SMTP server logs?

--Alex

---

<div class="post-metadata">

**Author:** ![rj23495](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@rj23495](https://discuss.elastic.co/u/rj23495)\
**Post date:** [August 9, 2019, 12:03pm UTC](https://discuss.elastic.co/t/smtp-failed-exception-500-bad-request/194161/3 "2019-08-09T12:03:52Z")

</div>

@spinscale Thanks for your suggestion i will make sure i attach the logs in a proper format.  
We are actually using smtp server of a managed cloud service, i have raised a request to them to look into this.

---

<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:** [September 6, 2019, 12:04pm UTC](https://discuss.elastic.co/t/smtp-failed-exception-500-bad-request/194161/4 "2019-09-06T12:04:11Z")

</div>

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