X-pack Watcher service : not able to send the mail

For mail configuration i have added the following piece of code in elasticsearch.yml
at the end of the file:
> xpack.watcher.enabled: true

    xpack.notification.email.account:
        gmail_account:
            profile: gmail
            smtp:
                auth: true
                starttls.enable: true
                host: smtp.gmail.com
                port: 587
                user: "kiranmadh"
                password: "************"

I have modified the following code in management -> watcher ->

"email_administrator": {
"email": {
"profile": "standard",
"attachments": {
"attached_data": {
"data": {
"format": "json"
}
}
},
"priority": "high",
"to": [
"kiran.kumar.illa@accenture.com"
],
"subject": "Encountered {{ctx.payload.hits.total}} errors",
"body": {
"text": "Too many error in the system, see attached data"
}
}

Logstash is also in running state...

I have restarted the ES but i have encountered with the following error and not able to receive any mail:

2017-06-16T19:30:39,932][ERROR][o.e.x.w.a.e.ExecutableEmailAction] [2HZAhP9] failed to execute action [jira/email_administrator]
javax.mail.MessagingException: failed to send email with subject [Encountered 38 errors] via account [gmail_account]
        at org.elasticsearch.xpack.notification.email.EmailService.send(EmailService.java:66) ~[x-pack-5.4.0.jar:5.4.0]
        at org.elasticsearch.xpack.notification.email.EmailService.send(EmailService.java:58) ~[x-pack-5.4.0.jar:5.4.0]
        at org.elasticsearch.xpack.watcher.actions.email.ExecutableEmailAction.execute(ExecutableEmailAction.java:86) ~[x-pack-5.4.0.jar:5.4.0]
        at org.elasticsearch.xpack.watcher.actions.ActionWrapper.execute(ActionWrapper.java:160) [x-pack-5.4.0.jar:5.4.0]

Please find the attached screen shot for reference.

Could you please help me on resolving this issue..
Thanks in advance

Hi Kiran,

What I see in the middle of your screenshot is

AuthenticationFailedException with a link after that like <https://accounts.google.com/signin.... >

Please log in via your web browser and then try again

Learn more at
https://support.google.com/mail/answer...

So the problem has to do with authentication of the gmail account configured in your elasticsearch.yml file. That's the account that is being used to send the email but it's failing authentication. If you have 2-factor authentication configured on that gmail account set up that could make this difficult.

You could start by visiting the link logged right after the AuthenticationFailedException and see if that resolves the issue for you.

Regards,
Lee

1 Like

Thanks Lee for your help..... i got it.. there is missing configuration from gmail account as below
"If you get an authentication error that indicates that you need to continue the sign-in process from a web browser when Watcher attempts to send email, you need to configure Gmail to Allow Less Secure Apps to access your account."

and one more change in the elasticsearch.yml file :
i should not provide the crendentials with in "" (double cotes)
It should be as shown below:
smtp:
auth: true
starttls.enable: true
host: smtp.gmail.com
port: 587
user: kiranma@gmil.com
password: ************

I have followed the above step and i am able to send the mail..

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