Error in sending email : [WATCHER]


(Aviral Srivastava) #1

"actions": [
"id": "email_admin",
"type": "email",
"status": "failure",
"reason": "MessagingException[failed to send email with subject [Watcher Executed] via account [S-IWEBTRANSLATORTO]]; nested: MessagingException[Could not convert socket to TLS]; nested: SSLHandshakeException[ PKIX path building failed: unable to find valid certification path to requested target]; nested: ValidatorException[PKIX path building failed: unable to find valid certification path to requested target]; nested: SunCertPathBuilderException[unable to find valid certification path to requested target]; "
Can anybody help

(Alexander Reelsen) #2


there seems to be an issue connecting via TLS to the SMTP server.

The SunCertPathBuilderException above indicates that a certificate was returned during the handshake that is not trusted. This message is seen on the client side of the connection. The SSLException above is seen on the server side of the connection.

You need to configure - which can be configured in watcher email settings

Hope this helps


(Aviral Srivastava) #3

Hi spinscale,
thanks for your response.
"trigger" : {
"schedule" : { "interval" : "10s" }
"input" : {
"search" : {
"request" : {
"indices" : [ "smartlog" ],
"body" : {
"query" : {
"match" : { "logLevel": "ERROR" }
"condition" : {
"compare" : {
"" : { "gt" : 50 }
"actions" : {
"email_admin" : {
"email": {
"to": "",
"subject": "Watcher Executed",
"body": "Congrats, you have successfully configured watcher to send email"
MY elasticsearch.yml CONFIGURATION :-
profile: outlook
auth: true
starttls.enable: true
port: 25
user: abcde
password: abcde
"actions": [
"id": "email_admin",
"type": "email",
"status": "failure",
"reason": "MessagingException[failed to send email with subject [Watcher Executed] via account [exchange_account]]; nested: AuthenticationFailedException[No authentication mechanisms supported by both server and client]; "

(Alexander Reelsen) #4


your second exception is different than the first. See the watch history

No authentication mechanisms supported by both server and client

This means that the server and the client could not negotiate an auth mechanism. What kind of server is that? Maybe there is a mail server configuration error, that it does not support user based auth?

Checking the log files of your mail server might help a lot here.


(Aviral Srivastava) #5

Dear Alex,

We are in a corporate environment. There is a corporate exchange server.
So, I do not have access to the server logs here.

I tried to connect to our corporate exchange server using TELNET from my system.
I was able to connect. and also send email from to ..
NOTE:- These are the same emails as I specified in the elasticsearch.yml and watcher configuration.

It seems I have issue in the elasticsearch.yml configuration.

(Alexander Reelsen) #6


please google for that particular error message. Looks to me as if smtp auth is not supported by exchange out of the box and requires configuration. Can you tell me how your current authentication works with your exchange server, so one can see if java mail supports it?

Also setting up a small java program usign javamail would allow to rule out java as a problem source.


(Aviral Srivastava) #7

Thanks Alex for your suggestion,

I wrote a smail java program using javamail and I was able to send email.
package com.mail;

import java.util.;
import javax.mail.
import javax.mail.internet.;
import javax.activation.

public class SendEmail
public static void main(String [] args)
// Recipient's email ID needs to be mentioned.
String to = "";

  // Sender's email ID needs to be mentioned
  String from = "";

  // Assuming you are sending email from localhost
  String host = "";

  // Get system properties
  Properties properties = System.getProperties();

  // Setup mail server
  properties.setProperty("", host);

  // Get the default Session object.
  Session session = Session.getDefaultInstance(properties);

     // Create a default MimeMessage object.
     MimeMessage message = new MimeMessage(session);

     // Set From: header field of the header.
     message.setFrom(new InternetAddress(from));

     // Set To: header field of the header.
     message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));

     // Set Subject: header field
     message.setSubject("This is the Subject Line!");

     // Now set the actual message
     message.setText("This is actual message");

     // Send message
     System.out.println("Sent message successfully....");
  }catch (MessagingException mex) {


It seems authentication is not required and can you help me what should i configure in elastisearch.yml file

(Alexander Reelsen) #8

recheck and adapt your watcher configuration, it is vastly different using SMTP auth and TLS, you should remove those settings.

(system) #9