SMTP failed exception 500 bad request

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

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

@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.