Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve ‘530 5.7.0 Must issue a STARTTLS command first. o63-v6sm4041934ywc.36 - gsmtp\n’ for elasticsearch?

I am creating an application where I need to send an email alert for my logs. Here is input to create a watcher:

PUT _xpack/watcher/watch/log_error_watch
{
  "trigger" : {
    "schedule" : { "interval" : "10s" } 
  },
  "input" : {
    "search" : {
      "request" : {
        "indices" : [ "testindexv4" ],
        "body" : {
          "query" : {
            "match" : { "log_level": "ERROR" }
          }
        }
      }
    }
  }
  ,
  "actions" : {
  "send_email" : { 
    "email" : { 
      "to" : "<mailId>@gmail.com", 
      "subject" : "Watcher Notification", 
      "body" : "error logs found" 
    }
  }
}
}

Here is configuration for elasticsearch.yml

xpack.security.enabled: false
xpack.notification.email.account:
      standard_account:
         profile: standard
         smtp:
             auth: false
             starttls.enable: false
             starttls.required: false
             host: smtp.gmail.com
             port: 587

When I try to run my watcher, I get the error as:

reason": "530 5.7.0 Must issue a STARTTLS command first. o63-v6sm4041934ywc.36 - gsmtp\n

any solution on the same please?

like image 281
Deva Avatar asked Sep 21 '18 12:09

Deva


1 Answers

It's solved now, all I need to do is enable TLS authentication.

Here is my updated content of elasticsearch.yml:

xpack.security.enabled: false 
xpack.notification.email.account:
      standard_account:
         profile: standard
         smtp:
             auth: true
             starttls.enable: true
             starttls.required: true
             host: smtp.gmail.com
             port: 587
             user: <mailId>
             password: <passowrd>
like image 159
Deva Avatar answered Oct 03 '22 07:10

Deva